SlideShare a Scribd company logo
1 of 30
FUNDAMENTALS OF HTML
HTML stands for Hypertext Markup Language, and it is the most widely used language
to write Web Pages.
Hypertext refers to the way in which Web pages (HTML documents) are linked
together. Thus the link available on a webpage are called Hypertext.
Basic HTML Document Example
<!DOCTYPE html>
<html>
<head>
<title>This is document title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>Document content goes here.....</p>
</body>
</html>
HTML Tags
As told earlier, HTML is a markup language and makes use of various tags to format the
content. These tags are enclosed within angle braces <Tag Name>. Except few tags, most
of the tags have their corresponding closing tags. For example <html> has its closing tag
</html> and <body> tag has its closing tag </body> tag etc. A browser does not display the
HTML tags, but uses them to determine how to display the document. HTML tags are not case sensitive.
HTML Document Structure
A typical HTML document will have following structure:
Document declaration tag
<html>
<head>
Document header related tags
</head>
<body>
Document body related tags
</body>
</html>
The <!DOCTYPE> Declaration
The <!DOCTYPE> declaration tag is used by the web browser to understand the type and
version of the HTML used in the document. The <!DOCTYPE> declaration is not case
sensitive. Current version of HTML is 5 and it makes use of the following declaration:
<!DOCTYPE html>
HTML Basic Tags
Heading Tags
HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>, <h4>,
<h5>, and <h6>. While displaying any heading, browser adds one line before and one line
after that heading.
Example
<!DOCTYPE html>
<html>
<head>
<title>Heading Example</title>
</head>
<body>
<h1>Hello LPU </h1>
<h2>Hello LPU </h2>
<h3>Hello LPU </h3>
<h4>Hello LPU </h4>
<h5>Hello LPU </h5>
<h6>Hello LPU </h6>
</body>
</html>
Paragraph Tag
The <p> tag offers a way to structure your text into different paragraphs. Each
paragraph of text should go in between an opening <p> and a closing </p> tag.
Browsers automatically add a single blank line before and after each <p> element
Example
<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title><
/head>
<body>
<p>Here is a first paragraph of text.</p>
<p>Here is a second paragraph of text.</p>
<p>Here is a third paragraph of text.</p>
</body>
</html>
.
Line Break Tag
Whenever you use the <br /> element, anything following it starts from the next
line. This tag is an example of an empty element, where you do not need opening
and closing tags, as there is nothing to go in between them.
The <br /> tag has a space between the characters br and the forward slash.
NB: If you omit this space, older browsers will have trouble rendering the line
break, while if you miss the forward slash character and just use <br> it is not valid
in XHTML
Example
<!DOCTYPE html>
<html>
<head>
<title>Line Break Example</title>
</head>
<body>
<p>Hello<br />
LPU<br />
Block -34<br />
CSE </p>
</body>
</html>
Centering Content
You can use <center> tag to put any content in the center of the page or any table cell.
Example
<!DOCTYPE html>
<html>
<head>
<title>Centring Content Example</title>
</head>
<body>
<p>Welcome to LPU</p>
<center>Welcome to School of CSE</center>
</body>
</html>
Horizontal Lines
Horizontal lines are used to visually break up sections of a document. The <hr /> tag
creates a line from the current position in the document to the right margin and breaks
the line accordingly.
For example you may want to give a line between two paragraphs as in the given
example below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Horizontal Line Example</title>
</head>
<body>
<p>This is paragraph one and should be on top</p>
<hr />
<p>This is paragraph two and should be at bottom</p>
</body>
</html>
Preserve Formatting
Sometimes you want your text to follow the exact format of how it is written in the
HTML document. In those cases, you can use the preformatted tag <pre>.
The <pre> tag defines preformatted text.
Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces and line
breaks. The text will be displayed exactly as written in the HTML source code.
Example
<!DOCTYPE html>
<html>
<head>
<title>Preserve Formatting Example</title>
</head>
<body>
<pre>function testFunction( strText )
{
alert (strText)
}
</pre>
</body>
</html>
HTML Elements
An HTML element is defined by a starting tag. If the element contains other content,
it ends with a closing tag, where the element name is preceded by a forward slash as
shown below with few tags:
Start Tag Content End Tag
<p> This is paragraph content. </p>
<h1> This is heading content. </h1>
<div> This is division content. </div>
NB: There are some HTML elements which don't need to be closed, such as <img.../>,
<hr /> and <br /> elements. These are known as void/empty elements.
Nested HTML Elements
Elements can be nested, which means you can write an
element, and before closing that element, you can start and
finish another element within that outer element.
Example
<!DOCTYPE html>
<html>
<head> <title>Example for Nested HTML Elements</title>
</head>
<body> <p>This is my paragraph text with <strong>bold</strong> word.</p>
</body>
</html>
HTML Formatting Tags
Bold Text
Anything that appears within <b>...</b> element, is displayed in bold as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Bold Text Example</title>
</head>
<body>
<p>Welcome to <b>LPU</b> Jalandhar</p>
</body>
</html>
Italic Text
Anything that appears within <i>...</i> element is displayed in italicized as shown
below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Italic Text Example</title>
</head>
<body>
<p>Welcome to <i>LPU</i> Jalandhar</p>
</body>
</html>
Underlined Text
Anything that appears within <u>...</u> element, is displayed with underline as shown
below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Underlined Text Example</title>
</head>
<body>
<p>Welcome to <u>LPU</u> Jalandhar</p>
</body>
</html>
Strike Text
Anything that appears within <strike>...</strike> element is displayed with strikethrough,
which is a thin line through the text as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Strike Text Example</title>
</head>
<body>
<p>This is completely <strike>bad</strike>idea</p>
</body>
</html>
Superscript Text
The content of a <sup>...</sup> element is written in superscript; the font size used is
the same size as the characters surrounding it but is displayed half a character's height
above the other characters.
Example
<!DOCTYPE html>
<html>
<head>
<title>Superscript Text Example</title>
</head>
<body>
<p>An example of <sup>superscript</sup> formatting tag</p>
</body>
</html>
Subscript Text
The content of a <sub>...</sub> element is written in subscript; the font size used is the
same as the characters surrounding it, but is displayed half a character's height beneath
the other characters.
Example
<!DOCTYPE html>
<html>
<head>
<title>Subscript Text Example</title>
</head>
<body>
<p>An example of <sub>subscript</sub> formatting tag</p>
</body>
</html>
Inserted and Deleted Text
Anything that appears within <ins>...</ins> element is displayed as inserted text.
Anything that appears within <del>...</del> element, is displayed as deleted text.
Example
<!DOCTYPE html>
<html>
<head>
<title>Inserted Text Example</title>
</head>
<body>
<p>This is an example of <del>old information</del> and <ins>new information</ins>
</p>
</body>
</html>
Larger Text
The content of the <big>...</big> element is displayed one font size larger than the rest of
the text surrounding it as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Larger Text Example</title>
</head>
<body>
<p>Welcome to <big>LPU</big> Jalandhar</p>
</body>
</html>
Smaller Text
The content of the <small>...</small> element is displayed one font size smaller than the
rest of the text surrounding it as shown below:
Example
<!DOCTYPE html>
<html>
<head>
<title>Smaller Text Example</title>
</head>
<body>
<p>Example of <small>small</small> formatting tag</p><
/body>
</html>
Emphasized Text
Anything that appears within <em>...</em> element is displayed as emphasized text.
Example
<!DOCTYPE html>
<html>
<head>
<title>Emphasized Text Example</title>
</head>
<body>
<p>This is an example of <em>emphasized</em> tag</p>
</body>
</html>
Marked Text
Anything that appears with-in <mark>...</mark> element, is displayed as marked with
yellow ink.
Example
<!DOCTYPE html>
<html>
<head>
<title>Marked Text Example</title>
</head>
<body>
<p>This is an example of <mark>marked</mark> tag</p>
</body>
</html>
Short Quotations
The <q>...</q> element is used when you want to add a double quote within a sentence.
Example
<!DOCTYPE html>
<html>
<head>
<title>Double Quote Example</title>
</head>
<body>
<p>Welcome to <q>LPU</q>Jalandhar</p>
</body>
</html>
Computer Code
Usually the content of the <code> element is presented in a monospaced font, just like
the code in most programming books. Monospaced typefaces are ones in which all or
most characters take up the same amount of horizontal space.
Example
<!DOCTYPE html>
<html>
<head>
<title>Computer Code Example</title>
</head>
<body>
<p>Regular text. <code>This is code.</code> Regular text.</p>
</body>
</html>
Comment
<!--This is a comment. Comments are not displayed in the
browser-->
Example
<!DOCTYPE html>
<html>
<head>
<title>Using Comment Tag</title>
</head>
<body>
<p>This is <!—not--> Internet Explorer.</p>
</body>
</html>
Style
• The <style> tag is used to define style information for a document.
• Inside the <style> element you specify how HTML elements should render in a
browser.
<html>
<head>
<style>
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>
<h1>A heading</h1>
<p>A paragraph.</p>
</body>
</html>
Example
• Multiple styles for the same elements:
<html>
<head>
<style>
h1 {color:red;}
p {color:blue;}
</style>
<style>
h1 {color:green;}
p {color:pink;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Text Direction
The <bdo>...</bdo> element stands for Bi-Directional Override and it is used to override
the current text direction.
Example
<!DOCTYPE html>
<html>
<head>
<title>Text Direction Example</title>
</head>
<body>
<p>This text will go left to right.</p>
<p><bdo dir="rtl">This text will go right to left.</bdo></p>
</body>
</html>
Citation
• The <cite> tag defines the title of a creative work (e.g.
a book, a poem, a song, a movie, a painting, a
sculpture, etc.).
• The text in the <cite> element usually renders in italic.
<!DOCTYPE html>
<html>
<body>
<h1>The cite element</h1>
<p><cite>The Scream</cite> by Edward Munch. Painted
in 1893.</p>
</body>
</html>

More Related Content

Similar to TagsL1.pptx (20)

Hyper text markup Language
Hyper text markup LanguageHyper text markup Language
Hyper text markup Language
 
IT Unit III.pptx
IT Unit III.pptxIT Unit III.pptx
IT Unit III.pptx
 
Learn HTML Easier
Learn HTML EasierLearn HTML Easier
Learn HTML Easier
 
Html1
Html1Html1
Html1
 
HTML
HTMLHTML
HTML
 
Week 4 Lecture Part 2
Week 4 Lecture Part 2Week 4 Lecture Part 2
Week 4 Lecture Part 2
 
Lesson plan htmltextformattingtag
Lesson plan htmltextformattingtagLesson plan htmltextformattingtag
Lesson plan htmltextformattingtag
 
Title, heading and paragraph tags
Title, heading and paragraph tagsTitle, heading and paragraph tags
Title, heading and paragraph tags
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Best HTML Training &Coaching in Ambala
Best HTML Training &Coaching in AmbalaBest HTML Training &Coaching in Ambala
Best HTML Training &Coaching in Ambala
 
Html ppt by Fathima faculty Hasanath college for women bangalore
Html ppt by Fathima faculty Hasanath college for women bangaloreHtml ppt by Fathima faculty Hasanath college for women bangalore
Html ppt by Fathima faculty Hasanath college for women bangalore
 
HTML.ppt
HTML.pptHTML.ppt
HTML.ppt
 
Lesson plan: HTML Formatting Texts and Paragraphs
Lesson plan: HTML Formatting Texts and ParagraphsLesson plan: HTML Formatting Texts and Paragraphs
Lesson plan: HTML Formatting Texts and Paragraphs
 
Presentation on HTML
Presentation on HTMLPresentation on HTML
Presentation on HTML
 
Html2
Html2Html2
Html2
 
Html.docx
Html.docxHtml.docx
Html.docx
 
Html
HtmlHtml
Html
 
Html example
Html exampleHtml example
Html example
 
Web Designing.docx
Web Designing.docxWeb Designing.docx
Web Designing.docx
 
Html basics NOTE
Html basics NOTEHtml basics NOTE
Html basics NOTE
 

Recently uploaded

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 

Recently uploaded (20)

Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 

TagsL1.pptx

  • 1. FUNDAMENTALS OF HTML HTML stands for Hypertext Markup Language, and it is the most widely used language to write Web Pages. Hypertext refers to the way in which Web pages (HTML documents) are linked together. Thus the link available on a webpage are called Hypertext. Basic HTML Document Example <!DOCTYPE html> <html> <head> <title>This is document title</title> </head> <body> <h1>This is a heading</h1> <p>Document content goes here.....</p> </body> </html>
  • 2. HTML Tags As told earlier, HTML is a markup language and makes use of various tags to format the content. These tags are enclosed within angle braces <Tag Name>. Except few tags, most of the tags have their corresponding closing tags. For example <html> has its closing tag </html> and <body> tag has its closing tag </body> tag etc. A browser does not display the HTML tags, but uses them to determine how to display the document. HTML tags are not case sensitive. HTML Document Structure A typical HTML document will have following structure: Document declaration tag <html> <head> Document header related tags </head> <body> Document body related tags </body> </html>
  • 3. The <!DOCTYPE> Declaration The <!DOCTYPE> declaration tag is used by the web browser to understand the type and version of the HTML used in the document. The <!DOCTYPE> declaration is not case sensitive. Current version of HTML is 5 and it makes use of the following declaration: <!DOCTYPE html> HTML Basic Tags Heading Tags HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. While displaying any heading, browser adds one line before and one line after that heading.
  • 4. Example <!DOCTYPE html> <html> <head> <title>Heading Example</title> </head> <body> <h1>Hello LPU </h1> <h2>Hello LPU </h2> <h3>Hello LPU </h3> <h4>Hello LPU </h4> <h5>Hello LPU </h5> <h6>Hello LPU </h6> </body> </html>
  • 5. Paragraph Tag The <p> tag offers a way to structure your text into different paragraphs. Each paragraph of text should go in between an opening <p> and a closing </p> tag. Browsers automatically add a single blank line before and after each <p> element Example <!DOCTYPE html> <html> <head> <title>Paragraph Example</title>< /head> <body> <p>Here is a first paragraph of text.</p> <p>Here is a second paragraph of text.</p> <p>Here is a third paragraph of text.</p> </body> </html> .
  • 6. Line Break Tag Whenever you use the <br /> element, anything following it starts from the next line. This tag is an example of an empty element, where you do not need opening and closing tags, as there is nothing to go in between them. The <br /> tag has a space between the characters br and the forward slash. NB: If you omit this space, older browsers will have trouble rendering the line break, while if you miss the forward slash character and just use <br> it is not valid in XHTML Example <!DOCTYPE html> <html> <head> <title>Line Break Example</title> </head> <body> <p>Hello<br /> LPU<br /> Block -34<br /> CSE </p> </body> </html>
  • 7. Centering Content You can use <center> tag to put any content in the center of the page or any table cell. Example <!DOCTYPE html> <html> <head> <title>Centring Content Example</title> </head> <body> <p>Welcome to LPU</p> <center>Welcome to School of CSE</center> </body> </html>
  • 8. Horizontal Lines Horizontal lines are used to visually break up sections of a document. The <hr /> tag creates a line from the current position in the document to the right margin and breaks the line accordingly. For example you may want to give a line between two paragraphs as in the given example below: Example <!DOCTYPE html> <html> <head> <title>Horizontal Line Example</title> </head> <body> <p>This is paragraph one and should be on top</p> <hr /> <p>This is paragraph two and should be at bottom</p> </body> </html>
  • 9. Preserve Formatting Sometimes you want your text to follow the exact format of how it is written in the HTML document. In those cases, you can use the preformatted tag <pre>. The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces and line breaks. The text will be displayed exactly as written in the HTML source code. Example <!DOCTYPE html> <html> <head> <title>Preserve Formatting Example</title> </head> <body> <pre>function testFunction( strText ) { alert (strText) } </pre> </body> </html>
  • 10. HTML Elements An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag, where the element name is preceded by a forward slash as shown below with few tags: Start Tag Content End Tag <p> This is paragraph content. </p> <h1> This is heading content. </h1> <div> This is division content. </div> NB: There are some HTML elements which don't need to be closed, such as <img.../>, <hr /> and <br /> elements. These are known as void/empty elements.
  • 11. Nested HTML Elements Elements can be nested, which means you can write an element, and before closing that element, you can start and finish another element within that outer element.
  • 12. Example <!DOCTYPE html> <html> <head> <title>Example for Nested HTML Elements</title> </head> <body> <p>This is my paragraph text with <strong>bold</strong> word.</p> </body> </html>
  • 13. HTML Formatting Tags Bold Text Anything that appears within <b>...</b> element, is displayed in bold as shown below: Example <!DOCTYPE html> <html> <head> <title>Bold Text Example</title> </head> <body> <p>Welcome to <b>LPU</b> Jalandhar</p> </body> </html>
  • 14. Italic Text Anything that appears within <i>...</i> element is displayed in italicized as shown below: Example <!DOCTYPE html> <html> <head> <title>Italic Text Example</title> </head> <body> <p>Welcome to <i>LPU</i> Jalandhar</p> </body> </html>
  • 15. Underlined Text Anything that appears within <u>...</u> element, is displayed with underline as shown below: Example <!DOCTYPE html> <html> <head> <title>Underlined Text Example</title> </head> <body> <p>Welcome to <u>LPU</u> Jalandhar</p> </body> </html>
  • 16. Strike Text Anything that appears within <strike>...</strike> element is displayed with strikethrough, which is a thin line through the text as shown below: Example <!DOCTYPE html> <html> <head> <title>Strike Text Example</title> </head> <body> <p>This is completely <strike>bad</strike>idea</p> </body> </html>
  • 17. Superscript Text The content of a <sup>...</sup> element is written in superscript; the font size used is the same size as the characters surrounding it but is displayed half a character's height above the other characters. Example <!DOCTYPE html> <html> <head> <title>Superscript Text Example</title> </head> <body> <p>An example of <sup>superscript</sup> formatting tag</p> </body> </html>
  • 18. Subscript Text The content of a <sub>...</sub> element is written in subscript; the font size used is the same as the characters surrounding it, but is displayed half a character's height beneath the other characters. Example <!DOCTYPE html> <html> <head> <title>Subscript Text Example</title> </head> <body> <p>An example of <sub>subscript</sub> formatting tag</p> </body> </html>
  • 19. Inserted and Deleted Text Anything that appears within <ins>...</ins> element is displayed as inserted text. Anything that appears within <del>...</del> element, is displayed as deleted text. Example <!DOCTYPE html> <html> <head> <title>Inserted Text Example</title> </head> <body> <p>This is an example of <del>old information</del> and <ins>new information</ins> </p> </body> </html>
  • 20. Larger Text The content of the <big>...</big> element is displayed one font size larger than the rest of the text surrounding it as shown below: Example <!DOCTYPE html> <html> <head> <title>Larger Text Example</title> </head> <body> <p>Welcome to <big>LPU</big> Jalandhar</p> </body> </html>
  • 21. Smaller Text The content of the <small>...</small> element is displayed one font size smaller than the rest of the text surrounding it as shown below: Example <!DOCTYPE html> <html> <head> <title>Smaller Text Example</title> </head> <body> <p>Example of <small>small</small> formatting tag</p>< /body> </html>
  • 22. Emphasized Text Anything that appears within <em>...</em> element is displayed as emphasized text. Example <!DOCTYPE html> <html> <head> <title>Emphasized Text Example</title> </head> <body> <p>This is an example of <em>emphasized</em> tag</p> </body> </html>
  • 23. Marked Text Anything that appears with-in <mark>...</mark> element, is displayed as marked with yellow ink. Example <!DOCTYPE html> <html> <head> <title>Marked Text Example</title> </head> <body> <p>This is an example of <mark>marked</mark> tag</p> </body> </html>
  • 24. Short Quotations The <q>...</q> element is used when you want to add a double quote within a sentence. Example <!DOCTYPE html> <html> <head> <title>Double Quote Example</title> </head> <body> <p>Welcome to <q>LPU</q>Jalandhar</p> </body> </html>
  • 25. Computer Code Usually the content of the <code> element is presented in a monospaced font, just like the code in most programming books. Monospaced typefaces are ones in which all or most characters take up the same amount of horizontal space. Example <!DOCTYPE html> <html> <head> <title>Computer Code Example</title> </head> <body> <p>Regular text. <code>This is code.</code> Regular text.</p> </body> </html>
  • 26. Comment <!--This is a comment. Comments are not displayed in the browser--> Example <!DOCTYPE html> <html> <head> <title>Using Comment Tag</title> </head> <body> <p>This is <!—not--> Internet Explorer.</p> </body> </html>
  • 27. Style • The <style> tag is used to define style information for a document. • Inside the <style> element you specify how HTML elements should render in a browser. <html> <head> <style> h1 {color:red;} p {color:blue;} </style> </head> <body> <h1>A heading</h1> <p>A paragraph.</p> </body> </html>
  • 28. Example • Multiple styles for the same elements: <html> <head> <style> h1 {color:red;} p {color:blue;} </style> <style> h1 {color:green;} p {color:pink;} </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 29. Text Direction The <bdo>...</bdo> element stands for Bi-Directional Override and it is used to override the current text direction. Example <!DOCTYPE html> <html> <head> <title>Text Direction Example</title> </head> <body> <p>This text will go left to right.</p> <p><bdo dir="rtl">This text will go right to left.</bdo></p> </body> </html>
  • 30. Citation • The <cite> tag defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.). • The text in the <cite> element usually renders in italic. <!DOCTYPE html> <html> <body> <h1>The cite element</h1> <p><cite>The Scream</cite> by Edward Munch. Painted in 1893.</p> </body> </html>