The document provides information about HTML (Hypertext Markup Language) including:
HTML is a markup language used to define the structure and layout of web pages. Key HTML elements are used to define headings, paragraphs, links, images and tables. HTML uses tags like <h1> for headings, <p> for paragraphs, <a> for links, <img> for images and <table> for tables. The document also provides examples of how to use various HTML tags and attributes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
370 views22 pages
Example Explained: This Is My Main Page
The document provides information about HTML (Hypertext Markup Language) including:
HTML is a markup language used to define the structure and layout of web pages. Key HTML elements are used to define headings, paragraphs, links, images and tables. HTML uses tags like <h1> for headings, <p> for paragraphs, <a> for links, <img> for images and <table> for tables. The document also provides examples of how to use various HTML tags and attributes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22
HTML is a language for describing web pages.
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
This is my Main Page
This is some text. This is a link to Page 1
This is a link to Page 2
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" />
Start tag * <p> <a href="default.htm" > <br />
Element content This is a paragraph This is a link
End tag * </p> </a>
<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
An inline style definition A text to display in a tool tip
@ 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 LINE BREAKS
<p>This is<br />a para<br />graph with line breaks</p> @@@@@@@@@@@@@@@@@@@@@@@@
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 text is bold
This text is big
This text is italic
This is computer output
This is subscript and superscript
@@ PREFORMATTED TAG <pre> Defines preformatted text eg. <html> <body> <pre> This is preformatted text. It preserves both spaces and line breaks. </pre> <p>The pre tag is good for displaying computer code:</p> <pre> for i = 1 to 10 print i next i </pre> </body> </html>
O/P This is preformatted text. It preserves both spaces and line breaks.
The pre tag is good for displaying computer code:
for i = 1 to 10 print i next i
@@ <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>
A short quotation: <q>This is a short quotation</q> O/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.
A short quotation: This is a short quotation @@@@@@@@@@@
<ins> Defines inserted text <p> a dozen is <del>twenty</del> <ins>twelve</ins> pieces </p> ==== <del> Defines deleted text
a dozen is twenty twelve pieces
Text Formatting Tags
Tag <b> <big> <em> <i> <small> <strong> <sub> <sup> <ins> <del> <s> <strike> <u> Description Defines bold text Defines big text Defines emphasized text Defines italic text Defines small text Defines strong text Defines subscripted text Defines superscripted text Defines inserted text Defines deleted text Deprecated. Use <del> instead Deprecated. Use <del> instead Deprecated. Use styles instead
Computer Output" Tags
Tag <code> <kbd> Description Defines computer code text Defines keyboard text
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
Citations, Quotations, and Definition Tags
Tag <abbr> <acronym> <address> <bdo> <blockquote> <q> <cite> <dfn> Description Defines an abbreviation Defines an acronym Defines an address element Defines the text direction Defines a long quotation Defines a short quotation Defines a citation Defines a definition term
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">
<h2>Look: Colored Background!</h2>
FONTS <p><font size="2" face="Verdana"> This is a paragraph. </font></p>
<p><font size="5" face="Times" color="red"> This is another paragraph. </font></p> ==
This is a paragraph.
This is another paragraph.
@@ TEXT ALIGNMENT <h1 align="center">This is heading 1</h1>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
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.
@ TO OPEN LINK IN NEW WINDOW <a href="lastpage.htm" target="_blank">Last Page</a>
<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>
<p>This chapter explains ba bla bla</p>
<h2>Chapter 5</h2> <p>This chapter explains ba bla bla</p> O/P
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" />
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" />
</form> O/P First name: Last name: Radio Buttons
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>
How it looks in a browser:
Male Female Checkboxes
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>
I have a bike: I have a car: I have an airplane:
The Form's Action Attribute and the Submit Button
When the user clicks on the "Submit" button, the content of the form is sent to the server. <form name="input" action="html_form_submit.asp" method="get"> Username: <input type="text" name="user" /> <input type="submit" value="Submit" /> </form>
How it looks in a browser:
Username: Submit
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
Verified PDF Download Web Development and Design Foundations With HTML5 7th Edition by Terry FelkeMorris eBook and TestBank Bundle Fast Instant Download