What
is HTML?
HTML is a language for describing
web pages.
- HTML stands for Hyper Text Markup Language
- HTML is a markup language
- A markup language is a set of markup tags
- The tags describe document content
- HTML documents contain HTML tags and
plain text
- HTML documents are also called web pages
HTML
Tags
HTML markup tags are usually called
HTML tags.
- HTML tags are keywords (tag names) surrounded by angle
brackets like <html>
- HTML tags normally come in pairs like <p>
and </p>
- The first tag in a pair is the start tag, the
second tag is the end tag
- The end tag is written like the start tag, with a slash
before the tag name
- Start and end tags are also called opening tags
and closing tags
<!DOCTYPE html>
<html>
<body>
<h1> Atul Chavan</h1>
<p> Jade Global</p>
</body>
</html>
Example
Explained
- The DOCTYPE declaration defines the document type
HTML5
<!DOCTYPE html>
HTML 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
"http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- The text between <html> and </html>
describes the web page
- The text between <body> and </body> is the
visible page content
- The text between <h1> and </h1> is
displayed as a heading
- The text between <p> and </p> is displayed
as a paragraph
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
Example
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
HTML Link
<a href="http://www.rowdyboss.blogspot.com">This
is a link</a>
HTML Tag Reference
You will learn more about HTML tags and attributes in the next chapters of
this tutorial.
Tag
|
Description
|
Defines an HTML document
|
|
Defines the document's body
|
|
Defines HTML headings
|
|
Defines a horizontal line
|
|
Defines a comment
|
HTML Text Formatting Tags
Tag
|
Description
|
Defines bold text
|
|
Defines emphasized text
|
|
Defines a part of text in an alternate voice or mood
|
|
Defines smaller text
|
|
Defines important text
|
|
Defines subscripted text
|
|
Defines superscripted text
|
|
Defines inserted text
|
|
Defines deleted text
|
|
Defines marked/highlighted text
|
CSS Example
<!DOCTYPE html>
<html>
<body>
<div style="opacity:0.5;position:absolute;left:50px;width:300px;height:150px;background-color:#40B3DF;"></div>
<div
style="font-family:verdana;padding:20px;border-radius:10px;border:10px
solid #EE872A;">
<div
style="opacity:0.3;position:absolute;left:120px;width:100px;height:200px;background-color:#8AC007;"></div>
<h3>Look! Styles and colors</h3>
<div style="letter-spacing:12px;">Manipulate
Text</div>
<div style="color:#40B3DF;">Colors <span
style="background-color:#B4009E;color:#ffffff;">Boxes</span></div>
<div style="color:#000000;">and
more...</div>
</div>
</body>
</html>
Image Example
<!DOCTYPE
html>
<html>
<body>
<h2>Norwegian
Mountain Trip</h2>
<img
border="0" src="/images/pulpit.jpg" alt="Pulpit
rock" width="304" height="228">
</body>
</html>
Table Example
<table style="width:300px">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
HTML Unordered Lists
An unordered list starts with the <ul> tag. Each list item starts with
the <li> tag.The list items are marked with bullets (typically small black circles).
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
HTML Ordered Lists
An ordered list starts with the <ol> tag. Each list item starts with
the <li> tag.The list items are marked with numbers.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
HTML Description Lists
A description list is a list of terms/names, with a description of each
term/name.The <dl> tag defines a description list.
The <dl> tag is used in conjunction with <dt> (defines terms/names) and <dd> (describes each term/name):
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>
HTML Layouts - Using <div> Elements
The div element is a block level element used for grouping HTML elements.The following example uses five div elements to create a multiple column layout, creating the same result as in the previous example:
Example
<!DOCTYPE html>
<html>
<body>
<div id="container" style="width:500px">
<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">Main Title of Web Page</h1></div>
<div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript</div>
<div id="content" style="background-color:#EEEEEE;height:200px;width:400px;float:left;">
Content goes here</div>
<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
Copyright © W3Schools.com</div>
</div>
</body>
</html>
<html>
<body>
<div id="container" style="width:500px">
<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">Main Title of Web Page</h1></div>
<div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript</div>
<div id="content" style="background-color:#EEEEEE;height:200px;width:400px;float:left;">
Content goes here</div>
<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
Copyright © W3Schools.com</div>
</div>
</body>
</html>
HTML Forms - The Input Element
The most important form element is the <input> element. The <input> element is used to select user information.
An <input> element can vary in many ways, depending on the type attribute. An <input> element can be of type text field, checkbox, password, radio button, submit button, and more.
The most common input types are described below.
Text Fields
<input type="text"> defines a one-line input field that a
user can enter text into:
<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
Note: The form itself is not visible. Also note that the default
width of a text field is 20 characters. First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
Radio Buttons
<input type="radio"> defines a radio button. Radio buttons
let a user select ONLY ONE of a limited number of choices:
<form>
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female
</form>
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female
</form>
Checkboxes
<input type="checkbox"> defines a checkbox. Checkboxes let a
user select ZERO or MORE options of a limited number of choices.
<form>
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
Submit Button
<input type="submit"> defines a submit button.A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input:
<form name="input"
action="demo_form_action.asp" method="get">
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
Iframe - Set Height and Width
The height and width attributes are used to specify the height and width of
the iframe.The attribute values are specified in pixels by default, but they can also be in percent (like "80%").
Example
<iframe src="demo_iframe.htm"
width="200" height="200"></iframe>
HTML Links - The id Attribute
The id attribute can be used to create a bookmark inside an HTML document.Tip: Bookmarks are not displayed in any special way. They are invisible to the reader.
Example
An anchor with an id inside an HTML document:
<a id="tips">Useful Tips Section</a>
Create a link to the "Useful Tips Section" inside the same
document:
<a href="#tips">Visit the Useful Tips
Section</a>
Or, create a link to the "Useful Tips Section" from another page:
<a href=" http://www.rowdyboss.blogspot.com/html_links.htm#tips">
Visit the Useful Tips Section</a>
Visit the Useful Tips Section</a>
0 comments