SlideShare una empresa de Scribd logo
1 de 19
Semantic HTML Code Prepared by: Sanjay Raval |  http:// www.usableweb.in /
What is semantic HTML coding? HTML was originally intended as a means of describing the content of a document, not as a means to make it appear visually pleasing. Semantic code returns to this original concept and encourages people to write code that describes the content rather than how that content should look.  For example, the title of a page could be coded like this: <font size=&quot;6&quot;><b>This is the page title</b></font> This would make the title large and bold giving it the appearance of a page title, but there is  nothing that describes it as a title in the code. This means a computer is unable to identify this as  being the page title. To write the same title semantically so that a computer understands that this is a title, you would  use the following code: The appearance of your heading can then be defined in a separate CSS file without interfering  your descriptive (semantic) HTML code. <h1>This is the page title</h1>
Why is semantic code important? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Elements and tags  An  element  is a construct consisting (usually) of an opening tag, some optional attributes, some content, and a closing tag. Elements can contain any number of further elements, which are, in turn, made up of tags, attributes, and content.  The following example shows two elements: the <p> element and the <em> element. ,[object Object],[object Object],A  tag  indicates the start and end of an element. The opening tag can contain multiple attributes, but it cannot contain other elements or tags, while the closing tag cannot contain anything but itself.  In the preceding example, there are four tags: an opening <p>, an opening <em>, a closing </em>, and a closing </p>.  Not all elements have closing tags. For example, <img>, <br>, <meta>, and <hr> are referred to as  self-closing elements ,  empty elements , or  replaced elements . Such elements are not container tags—that is, you would not write <hr>some content</hr> or <br>some content</br>—and any content or.  In HTML, a self-closing element is written simply as <img>, <br>, <meta>, or <hr>. In XHTML, a self-closing element requires a space and a trailing slash, such as <img />, <br />, <meta />, or <hr />.
Attributes  Attributes  appear within tags, and they can only contain the value of the attribute, for instance: <p class=&quot;example&quot;>Here is some text, some of which is <em>emphasized</em></p>  This example shows the class attribute. An attribute can contain multiple, space-separated values, which is useful if you need to apply different classes to one element. For instance, if you have two styles, one named example and another named reference, you can apply them both to a paragraph like so: <p class=&quot;example reference&quot;>   Other attributes you may have already encountered might include alt, src, and title, but there are many more attributes, some element-specific (like the selected attribute used with the <option> tag) and some not (like the class and id attributes).
Divs and spans  A  div  (short for “division”) is used for marking out a block of content, such as the main content block of your document, the main navigation, the header, or the footer. As such, it is a  block  element. It can contain further elements, including more divs if required, but it cannot be contained within an inline element.  For example, a simple website may have a header, a main column of content, a secondary column of content, and a footer. The (X)HTML for this could look like the following: These content blocks can then be positioned and displayed as required using CSS.  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Divs and spans A  span  is used for marking out sections  within  a block element and sometimes inside another inline element. It is an  inline  element, just the same as <em>, <strong>, or <a>, except without any semantic meaning—it is simply a generic container. It can itself contain further inline elements, including more spans.  For example, say you wish to color the first two words of a paragraph red, keeping the rest of the paragraph black. You can use a <span> for this:  A span  cannot  contain a block element—that is, you cannot place a <div> within a <span> and expect it to work the way you want. ,[object Object],[object Object],[object Object],[object Object]
Block and inline elements  To oversimplify things a little, every element in (X)HTML is contained within a box, and that box is either a block-level box or an inline-level box. Figure 1-1.  The box model, applied to block and inline boxes   A  block-level box , such as a div, a paragraph, or a heading, begins rendering on a new line in the document and forces a subsequent element to start rendering on a new line below. It is not possible to place two block elements alongside each other without using CSS.   An  inline-level box , such as a <span> or an <em>, begins rendering wherever you place it within the document and does not force any line breaks. It is not possible to stack two adjacent inline elements one on top of the other without using CSS. Furthermore, when an element is inline, if you apply margin-top/bottom or padding-top/bottom to it, then the value will be ignored—only margins and padding on the left and right have an effect.
Id and class attributes The id attribute is used to identify elements and mark up specific functional areas of a website, and the class attribute is used to classify one or more elements. These important attributes help you target elements when it comes to styling or scripting.  Id attribute value can be used just once per page, whereas a class attribute value can be used multiple times.   You can also apply an id  and  a class to one element: These two attributes are not tied to a specific tag; any tag whatsoever can be given either or both attributes. <body id=&quot;homepage&quot; class=&quot;page&quot;> In CSS, you will have to declare an id with a hash mark (#) and classes with a period (.), like this: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Structure of an xhtml document First we see a doctype declaration. A doctype declaration provides an indication as to what Document Type Definition (DTD) you’re going to be writing your markup to. After the root <html> element is open, we have the <head> of the document, which contains a <title> and can also contain <style>, <script>, <meta>, and <link> elements. <title> is the only compulsory element within the head, and it will be displayed in your browser’s title bar.   Following the closing <head> tag is the opening <body> tag, which can contain any nonhead-specific markup: paragraphs, lists, images, and so on.   The closing <body> tag is followed immediately by the closing <html> tag. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Doctype declaration There are three XHTML doctypes available.  The XHTML doctypes are Strict, Transitional, and Frameset. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using the Right Tag
Headings These tags are good for creating titles or section headings.  Headings are defined with the  <h1>  to  <h6>  tags.  <h1>  defines the largest heading and  <h6>  defines the smallest heading.  here are the examples: Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6 You just wrap the preferred heading tag around the text, like so:  Heading are block level elements and appear bold and big. The title of your page should be made into a level-one heading. The rest of your page should be divided into sections with further heading tags, getting progressively smaller for points and sub-points. Try not to skip levels (like going from a <h2> to a <h4>).  <h3>Heading 3</h3>
Line breaks and horizontal rules The  <br>  tag is used when you want to break a line, but don’t want to start a new paragraph.  The  <br>  tag forces a line break wherever you place it.  This should only be used to force line breaks where they are required, and never to apply more vertical spacing between paragraphs or such in a document—that is more properly done with CSS.  if you are writing XHTML rather than HTML, the element should be self-closing, like so: <br />.  ----------------------------------------------------------------------------------------------------------------------------------- A  horizontal rule  is created in HTML with the  <hr>  element. It inserts into the document a line, which is described to represent a boundary between different sections of a document.  The hr element has no uncommon attributes and should be styled using CSS if the default appearance in unsatisfactory. Also, like the line break, if you are writing XHTML and not HTML, use the self-closing form <hr />.
Paragraphs Use the  paragraph  tag when you want to break up two streams of information into separate thoughts.  Don’t use blank <p> tag to add some vertical space between two page elements. Also the vertical space due to blank <p> tag can vary from browser to browser.  Also don’t use <p> just to get a line break in a page. Here use <br /> tag which is made for that purpose. Example: ,[object Object],[object Object]
Lists Three list types are available in current (X)HTML versions: unordered lists <ul>, ordered lists <ol>, and definition lists <dl>. The differences between the list types are fairly minimal and straightforward: An  unordered list  should be used when your content is (as you would expect) not in any particular order. An  ordered list  should be used when your content  is  in an order of some kind: alphabetical, numerical, and so on. A  definition list  is designed for associating names or terms with values or other data—any items that have a direct relationship with one another, such as a glossary of terms.
List – Unordered list <ul> Lists follow a common skeleton every time — an outer container tag, and a new tag for each bullet.  Observe: ,[object Object],[object Object],[object Object],[object Object],[object Object],<ul> <li>Bullet 1</li> <li>Bullet 2</li> <li>Bullet 3</li> </ul>
List – Ordered list <ol> If you want your list to be ordered instead of unordered, it’s a simple matter of just substituting the <ul> elements with <ol>s, which of course stand for  O rdered  L ists. This will create: 1. List Item 1 2. List Item 2 3. List Item 3 See? All that was changed was that one letter. Beyond that, the rest of the structure remains intact  <ol> <li>List Item 1</li> <li>List Item 2</li> <li>List Item 3</li> </ol>
List – Definition list <dl> There is this third list type, useful for information that comes in pairs.  The definition list consists of an opening <dl>, followed by a definition term (<dt>), and then any number of definition descriptions (<dd>).  A typical definition list looks like this: ,[object Object],[object Object],[object Object],[object Object],[object Object],<dl> <dt>Strive:</dt> <dd>to make strenuous efforts toward any goal</dd> </dl>

Más contenido relacionado

La actualidad más candente (17)

Html
HtmlHtml
Html
 
Intro to html
Intro to htmlIntro to html
Intro to html
 
Html
HtmlHtml
Html
 
Michael(tm) Smith ED09 presentation
Michael(tm) Smith ED09 presentationMichael(tm) Smith ED09 presentation
Michael(tm) Smith ED09 presentation
 
Html intro
Html introHtml intro
Html intro
 
Html ppt
Html pptHtml ppt
Html ppt
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
 
Lecture1
Lecture1Lecture1
Lecture1
 
Module 2
Module 2Module 2
Module 2
 
Html1
Html1Html1
Html1
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Markup Documents
Markup DocumentsMarkup Documents
Markup Documents
 
HTML & Textile Training
HTML & Textile TrainingHTML & Textile Training
HTML & Textile Training
 
O9xml
O9xmlO9xml
O9xml
 
Html Ppt
Html PptHtml Ppt
Html Ppt
 
Basic HTML
Basic HTMLBasic HTML
Basic HTML
 
Html
HtmlHtml
Html
 

Similar a Semantically Correct And Standards Compliance Html

Similar a Semantically Correct And Standards Compliance Html (20)

Empowerment Technologies Lecture 10 (Philippines SHS)
Empowerment Technologies Lecture 10 (Philippines SHS)Empowerment Technologies Lecture 10 (Philippines SHS)
Empowerment Technologies Lecture 10 (Philippines SHS)
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
Module 2 Lesson 1
Module 2 Lesson 1Module 2 Lesson 1
Module 2 Lesson 1
 
Wordpress & HTML5 by Rob Larsen
Wordpress & HTML5 by Rob LarsenWordpress & HTML5 by Rob Larsen
Wordpress & HTML5 by Rob Larsen
 
INTRODUCTION TO HTML
INTRODUCTION TO HTMLINTRODUCTION TO HTML
INTRODUCTION TO HTML
 
html complete notes
html complete noteshtml complete notes
html complete notes
 
html compete notes basic to advanced
html compete notes basic to advancedhtml compete notes basic to advanced
html compete notes basic to advanced
 
Web1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSSWeb1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSS
 
Html
HtmlHtml
Html
 
Introduction to HTML.pptx
Introduction to HTML.pptxIntroduction to HTML.pptx
Introduction to HTML.pptx
 
Intr To Html & Xhtml
Intr To Html & XhtmlIntr To Html & Xhtml
Intr To Html & Xhtml
 
html-basic.pdf
html-basic.pdfhtml-basic.pdf
html-basic.pdf
 
HTML
HTMLHTML
HTML
 
Class 1 handout (2) html exercises
Class 1 handout (2) html exercisesClass 1 handout (2) html exercises
Class 1 handout (2) html exercises
 
Diva
DivaDiva
Diva
 
Html
HtmlHtml
Html
 
Html
HtmlHtml
Html
 
Introduction to HTML- Week 3- HTMLSyntax
Introduction to HTML- Week 3- HTMLSyntaxIntroduction to HTML- Week 3- HTMLSyntax
Introduction to HTML- Week 3- HTMLSyntax
 
How an html file is structured
How an html file is structuredHow an html file is structured
How an html file is structured
 
Html
HtmlHtml
Html
 

Último

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Semantically Correct And Standards Compliance Html

  • 1. Semantic HTML Code Prepared by: Sanjay Raval | http:// www.usableweb.in /
  • 2. What is semantic HTML coding? HTML was originally intended as a means of describing the content of a document, not as a means to make it appear visually pleasing. Semantic code returns to this original concept and encourages people to write code that describes the content rather than how that content should look. For example, the title of a page could be coded like this: <font size=&quot;6&quot;><b>This is the page title</b></font> This would make the title large and bold giving it the appearance of a page title, but there is nothing that describes it as a title in the code. This means a computer is unable to identify this as being the page title. To write the same title semantically so that a computer understands that this is a title, you would use the following code: The appearance of your heading can then be defined in a separate CSS file without interfering your descriptive (semantic) HTML code. <h1>This is the page title</h1>
  • 3.
  • 4.
  • 5. Attributes Attributes appear within tags, and they can only contain the value of the attribute, for instance: <p class=&quot;example&quot;>Here is some text, some of which is <em>emphasized</em></p> This example shows the class attribute. An attribute can contain multiple, space-separated values, which is useful if you need to apply different classes to one element. For instance, if you have two styles, one named example and another named reference, you can apply them both to a paragraph like so: <p class=&quot;example reference&quot;> Other attributes you may have already encountered might include alt, src, and title, but there are many more attributes, some element-specific (like the selected attribute used with the <option> tag) and some not (like the class and id attributes).
  • 6.
  • 7.
  • 8. Block and inline elements To oversimplify things a little, every element in (X)HTML is contained within a box, and that box is either a block-level box or an inline-level box. Figure 1-1. The box model, applied to block and inline boxes   A block-level box , such as a div, a paragraph, or a heading, begins rendering on a new line in the document and forces a subsequent element to start rendering on a new line below. It is not possible to place two block elements alongside each other without using CSS.   An inline-level box , such as a <span> or an <em>, begins rendering wherever you place it within the document and does not force any line breaks. It is not possible to stack two adjacent inline elements one on top of the other without using CSS. Furthermore, when an element is inline, if you apply margin-top/bottom or padding-top/bottom to it, then the value will be ignored—only margins and padding on the left and right have an effect.
  • 9.
  • 10.
  • 11.
  • 13. Headings These tags are good for creating titles or section headings. Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading and <h6> defines the smallest heading. here are the examples: Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6 You just wrap the preferred heading tag around the text, like so: Heading are block level elements and appear bold and big. The title of your page should be made into a level-one heading. The rest of your page should be divided into sections with further heading tags, getting progressively smaller for points and sub-points. Try not to skip levels (like going from a <h2> to a <h4>). <h3>Heading 3</h3>
  • 14. Line breaks and horizontal rules The <br> tag is used when you want to break a line, but don’t want to start a new paragraph. The <br> tag forces a line break wherever you place it. This should only be used to force line breaks where they are required, and never to apply more vertical spacing between paragraphs or such in a document—that is more properly done with CSS. if you are writing XHTML rather than HTML, the element should be self-closing, like so: <br />. ----------------------------------------------------------------------------------------------------------------------------------- A horizontal rule is created in HTML with the <hr> element. It inserts into the document a line, which is described to represent a boundary between different sections of a document. The hr element has no uncommon attributes and should be styled using CSS if the default appearance in unsatisfactory. Also, like the line break, if you are writing XHTML and not HTML, use the self-closing form <hr />.
  • 15.
  • 16. Lists Three list types are available in current (X)HTML versions: unordered lists <ul>, ordered lists <ol>, and definition lists <dl>. The differences between the list types are fairly minimal and straightforward: An unordered list should be used when your content is (as you would expect) not in any particular order. An ordered list should be used when your content is in an order of some kind: alphabetical, numerical, and so on. A definition list is designed for associating names or terms with values or other data—any items that have a direct relationship with one another, such as a glossary of terms.
  • 17.
  • 18. List – Ordered list <ol> If you want your list to be ordered instead of unordered, it’s a simple matter of just substituting the <ul> elements with <ol>s, which of course stand for O rdered L ists. This will create: 1. List Item 1 2. List Item 2 3. List Item 3 See? All that was changed was that one letter. Beyond that, the rest of the structure remains intact <ol> <li>List Item 1</li> <li>List Item 2</li> <li>List Item 3</li> </ol>
  • 19.