Example Explained: This Is My Main Page
Example Explained: This Is My Main Page
HTML stands for Hyper Text Markup Language HTML is not a programming language, it is a markup language A markup language is a set of markup tags HTML uses markup tags to describe web pages
<html> <body> <h1>My First Heading</h1> <p>My first paragraph</p> </body> </html>
Example Explained
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><head> </head><body> <h1>This is my Main Page</h1> <p>This is some text.</p> <p><a href="page1.htm">This is a link to Page 1</a></p> <p><a href="page2.htm">This is a link to Page 2</a></p> </body></html>
o/p
1.HTML HEADING <h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3> 2. HTML PARAGRAPHS == <p>This is a paragraph</p> <p>This is another paragraph</p>
3.HTML LINKS ==== <a href="http://www.w3schools.com">This is a link</a> 4.HTML IMAGES == <img src="w3schools.jpg" width="104" height="142" />
<br> is an empty element without a closing tag (it defines a line break). In XHTML, XML, and future versions of HTML, all elements must be closed. Adding a slash to the start tag, like <br />, is the proper way of closing empty elements, accepted by HTML, XHTML and XML. Even if <br> works in all browsers, writing <br /> instead is more future proof.
@ HTML tags are not case sensitive: <P> means the same as <p>. Plenty of web sites use uppercase HTML tags in their pages. @ Attribute values should always be enclosed in quotes. Below is a list of some attributes that are standard for most HTML elements: Attribute class id Value class_rule or style_rule id_name Description The class of the element A unique id for the element
style title
style_definition tooltip_text
@ COMMENT == <!-- This is a comment --> You will learn more about HTML tags and attributes in the next chapters of this tutorial. Tag <html> <body> <h1> to <h6> <hr /> <!--> Description Defines an HTML document Defines the document's body Defines header 1 to header 6 Defines a horizontal rule Defines a comment
HTML TEXT FORMATTING <html> <body> <p><b>This text is bold</b></p> <p><big>This text is big</big></p> <p><i>This text is italic</i></p> <p><code>This is computer output</code></p> <p>This is<sub> subscript</sub> and <sup>superscript</sup></p> </body> </html>
O/P
This is preformatted text. It preserves both spaces and line breaks.
@@ <code> Defines computer code text ,<kbd> Defines keyboard text, <samp> Defines sample computer code, <tt> Defines teletype text , <var> Defines a variable <html> <body> <code>Computer code</code> <br>
<kbd>Keyboard input</kbd> <br> <tt>Teletype text</tt> <br> <samp>Sample text</samp> <br> <var>Computer variable</var> <br> <p> <b>Note:</b> These tags are often used to display computer/programming code. </p> </body> </html> O/P = Computer code
Keyboard input Teletype text
Sample text Computer variable Note: These tags are often used to display computer/programming code.
@@ ADDRESS @ <html> <body> <address> Donald Duck<br> BOX 555<br> Disneyland<br> USA </address> </body> </html> O/P == Donald Duck BOX 555 Disneyland USA
@@ABBEREVATIONS @<abbr> Defines an abbreviation , <acronym> Defines an acronym <abbr title="United Nations">UN</abbr> <br /> <acronym title="World Wide Web">WWW</acronym>
O/P == UN WWN
TEXT DIRECTION @@ <bdo> Defines the text direction ,,, rtl= RIGHT TO LEFT <bdo dir="rtl"> Here is some Hebrew text</bdo> Eg. Here is some Hebrew text
@@ <blockquote> Defines a long quotation <q> Defines a short quotation A blockquote quotation: <blockquote> This is a long quotation. This is a long quotation. This is a long quotation. This is a long quotation. This is a long quotation. </blockquote>
<p><b>The browser inserts line breaks and margins for a blockquote element.</b></p>
This is a long quotation. This is a long quotation. This is a long quotation. This is a long quotation. This is a long quotation. The browser inserts line breaks and margins for a blockquote element.
Defines sample computer code Defines teletype text Defines a variable Defines preformatted text Deprecated. Use <pre> instead Deprecated. Use <pre> instead Deprecated. Use <pre> instead
@@@@@@@@@@@@@@@@@@@@@@@
These tags and attributes should be avoided: Tags <center> Description Defines centered content
<font> and <basefont> <s> and <strike> <u> Attributes align bgcolor color
Defines HTML fonts Defines strikeout text Defines underlined text Description Defines the alignment of text Defines the background color Defines the text color
@<body bgcolor="yellow">
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
HTML LINKS
<p> <a href="lastpage.htm"> This text</a> is a link to a page on this Web site. </p> O/P== This text is a link to a page on this Web site.
<p> If you set the target attribute of a link to "_blank", the link will open in a new window. </p>
@@LINK TO LOCATN 2 THE SAME PAGE <p> <a href="#C4">See also Chapter 4.</a> </p> <h2>Chapter 1</h2> <p>This chapter explains ba bla bla</p> <h2>Chapter 2</h2> <p>This chapter explains ba bla bla</p> <h2>Chapter 3</h2> <p>This chapter explains ba bla bla</p> <h2><a name="C4">Chapter 4</a></h2>
Chapter 1
This chapter explains ba bla bla
Chapter 2
This chapter explains ba bla bla
Chapter 3
This chapter explains ba bla bla
Chapter 4
This chapter explains ba bla bla
@@@@@@@@@@@@@@@@@@@@@@@@
HTML IMAGES
<h2>Norwegian Mountain Trip</h2> <img border="0" src="/images/pulpit.jpg" width="304" height="228" /> @ <p> An image: <img src="constr4.gif" width="144" height="50" /> </p> @INSERT IMAGES 4M DIFF LOCATN <p>An image from another folder:</p> <img src="/images/chrome.gif" width="33" height="32" /> @ ALT ATTRIBUTE
<img src="boat.gif" alt="Big Boat" /> The "alt" attribute tells the reader what he or she is missing on a page if the browser can't load images. The browser will then display the alternate text instead of the image. It is a good practice to include the "alt" attribute for each image on a page, to improve the display and usefulness of your document for people who have text-only browsers. @ BACKGRND IMAGE
<body background="background.jpg"> @ ALIGN IMAGES <img src="hackanm.gif" align="bottom" width="48" height="48" />
@ ADJUST IMAGES 2DIFF SIZES <p> <img src="hackanm.gif" width="20" height="20" /> </p> <p> <img src="hackanm.gif" width="45" height="45" /> </p>
<map name="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm" /> <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm" /> <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm" /> </map> O/P
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
HTML TABLES
<h4>Two rows and three columns:</h4> <table border="1"> <tr> <td>100</td> <td>200</td>
<td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> O/P Two rows and three columns: 100 200 300 400 500 600
@TABLE WID NO BORDER <table> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> O/P 100 200 300 400 500 600
@cell THAT SPANS MORE DN 1 ROW/COLUMN <table border="1"> <tr> <th>Name</th> <th colspan="2">Telephone</th> </tr> <tr> <td>Bill Gates</td> <td>555 77 854</td> <td>555 77 855</td> </tr> </table> O/P Cell that spans two columns: Name Telephone
<table border="1"> <tr> <th>First Name:</th> <td>Bill Gates</td> </tr> <tr> <th rowspan="2">Telephone:</th> <td>555 77 854</td> </tr> <tr> <td>555 77 855</td> </tr> </table> O/P
Cell that spans two rows: First Name: Bill Gates 555 77 854 Telephone: 555 77 855
@ TABLE INSIDE TABLE <table border="1"> <tr> <td> <p>This is a paragraph</p> <p>This is another paragraph</p> </td> <td>This cell contains a table: <table border="1"> <tr> <td>A</td> <td>B</td> </tr> <tr> </td> </tr>
@ cellpadding <h4>Without cellpadding:</h4> <table border="1"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td>
<h4>With cellpadding:</h4> <table border="1" cellpadding="10"> <tr> <td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table> o/p Without cellpadding: First Row
Second
Row
@cellspacing <h4>With cellspacing:</h4> <table border="1" cellspacing="10"> <tr><td>First</td> <td>Row</td> </tr> <tr> <td>Second</td> <td>Row</td> </tr> </table>
Second Row
@table bakgrnd color <table border="1" bgcolor="red"> <tr> o/p First Row
Second Row
@@@@@@@@@@@@@@@@@@@
HTML LIST
Unordered Lists
<ul> <li>Coffee</li> <li>Milk</li> </ul>
Coffee Milk
Ordered Lists
An ordered list is also a list of items. The list items are marked with numbers.
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. <ol> <li>Coffee</li> <li>Milk</li> </ol> Here is how it looks in a browser: 1. Coffee 2. Milk
Definition Lists
A definition list starts with a <dl> tag (definition list). Each term starts with a <dt> tag (definition term). Each description starts with a <dd> tag (definition description). <dl> <dt>Coffee</dt> <dd>Black hot drink</dd> <dt>Milk</dt> <dd>White cold drink</dd> </dl> Coffee Black hot drink Milk White cold drink
@@@@@@@@@@@@@@@@@@@@@@@@
HTML FRAME.
<form> First name: <input type="text" name="firstname" /> <br /> Last name: <input type="text" name="lastname" />
Radio Buttons are used when you want the user to select 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>
Checkboxes are used when you want the user to select one or more options of a limited number of choices.
<form> I have a bike: <input type="checkbox" name="vehicle" value="Bike" /> <br /> I have a car: <input type="checkbox" name="vehicle" value="Car" /> <br /> I have an airplane: <input type="checkbox" name="vehicle" value="Airplane" /> </form>
DROP N DOWN BOX <form action=""> <select name="cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="fiat">Fiat</option> <option value="audi">Audi</option> </select> </form> O/P