HTML Basics
HTML Basics
(Introduction to WWW and HTML, Steps for hosting a website, Structure of HTML,
HTML elements and attributes, Headings, Paragraphs, Formatting tags, line breaks,
Comments, Links, Images, Lists, HTML5 Semantic Elements (header, footer, nav,
section, article, nav, aside), HTML Tables.)
HTML
<section>
<h1>WWF's Panda symbol</h1>
<p>The Panda has become the symbol of WWF. The well-known panda logo of WWF
originated from a panda named Chi Chi that was transferred from the Beijing Zoo to the
London Zoo in the same year of the establishment of WWF.</p>
</section>
HTML <article> Element
The <article> element specifies independent, self-contained content.
An article should make sense on its own, and it should be possible to distribute it
independently from the rest of the web site.
Examples of where an <article> element can be used:
Forum post
Blog post
Newspaper article
Example:
Three articles with independent, self-contained content:
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is
the world's most popular web browser today!</p>
</article>
<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has
been the second most popular web browser since January, 2018.</p>
</article>
<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015.
Microsoft Edge replaced Internet Explorer.</p>
</article>
HTML <aside> Element
The <aside> element defines some content aside from the content it is placed in (like a
sidebar).
The <aside> content should be indirectly related to the surrounding content.
Example:
Display some content aside from the content it is placed in:
<p>My family and I visited The Epcot center this summer. The weather was nice, and
Epcot was amazing! I had a great summer together with my family!</p>
<aside>
<h4>Epcot Center</h4>
<p>Epcot is a theme park at Walt Disney World Resort featuring exciting attractions,
international pavilions, award-winning fireworks and seasonal special events.</p>
</aside>
Unit II:HTML Forms and CSS
HTML Forms (input, select, textarea, button, datalist), Input types (text, password,
submit, radio, checkbox, date, email), Input attributes (value, readonly, disabled,
maxlength, autocomplete, list, min, max, placeholder), HTML5 form validation (required
and pattern attribute of input type), Applying style to html using CSS (Inline, Internal and
External CSS, Colors, Fonts, Borders, Padding, Applying style using class and id
attribute)
HTML forms
Form is used to collect information from a user. They are used to pass data to a server.An HTML
form is a section of a document containing normal content, markup, special elements called
controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. Users generally
"complete" a form by modifying its controls (entering text, selecting menu items, etc.), before
submitting the form to an agent for processing (e.g., to a Web server, to a mail server, etc.)
<form>
input elements
</form>
The <form> tag is used to create an HTML form for user input. The <form> element can contain
one or more of the following form elements:
<input>
<textarea>
<button>
<select>
<option>
<optgroup>
<fieldset>
<label>
Here's a simple form that includes labels, radio buttons, and push buttons (reset the form or
submit it):
<FORM action="http://somesite.com/prog/adduser" method="post">
<P>
<LABEL for="firstname">First name: </LABEL>
<INPUT type="text" id="firstname"><BR>
<LABEL for="lastname">Last name: </LABEL>
<INPUT type="text" id="lastname"><BR>
<LABEL for="email">email: </LABEL>
<INPUT type="text" id="email"><BR>
<INPUT type="radio" name="sex" value="Male"> Male<BR>
<INPUT type="radio" name="sex" value="Female"> Female<BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</P>
</FORM>
Attributes
Attribute Value Description
Specifies where to send the form-data when a form is
action URL
submitted
get Specifies the HTTP method to use when sending
method
post form-data
name Text Specifies the name of a form
_blank, _self Specifies where to display the response that is
target
_parent, _top received after submitting the form
In the section on the LABEL element, we discuss marking up labels such as "First name".
The BUTTON element
Buttons created with the BUTTON element function just like buttons created with the INPUT
element, but they offer richer rendering possibilities: the BUTTON element may have content.
The <button> tag defines a clickable button.
Inside a <button> element you can put content, like text or images. This is the difference
between this element and buttons created with the <input> element.
<!DOCTYPE html>
<html>
<body>
<button type="button" onclick="alert('Hello world!')">Click Me!</button>
</body>
</html>
Date
The <input type="date"> is used for input fields that should contain a date.
<form>
<label for="birthday">Birthday:</label>
<form>
<h2 class="city">Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</body>
</html>
Difference Between Class and ID
A class name can be used by multiple HTML elements, while an id name must only be used by
one HTML element within the page:
Example
<style>
/* Style the element with the id "myHeader" */
#myHeader {
background-color: lightblue;
color: black;
padding: 40px;
text-align: center;
}
/* Style all elements with the class name "city" */
.city {
background-color: tomato;
color: white;
padding: 10px;
}
</style>
<!-- An element with a unique id -->
<h1 id="myHeader">My Cities</h1>
<!-- Multiple elements with same class -->
<h2 class="city">London</h2>
<p>London is the capital of England.</p>
<h2 class="city">Paris</h2>
<p>Paris is the capital of France.</p>
<h2 class="city">Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>