03. HTML Elements

HTML Element Syntax


  1. HTML element starts with a start tag/opening tag.
  2. HTML element ends with an end tag/closing tag.
  3. The Element content is everything between the start and the end tag.
  4. Some HTML elements have empty content.
  5. Empty elements are closed in the start tag.
  6. Most HTML elements can have attributes.


Nested Elements

<html>
<body>
<p>This is my first paragraph</p>
</body>
</html>

The <p> Element

1.The <p> element defines a new paragraph in the HTML document
2.The element has a start tag <p> and an end tag</p>
3.The element content is : This is my first paragraph

The <body> Element

1.The Element has a Start tag <body> and an end tag</body>
2.The element content is another HTML element ( one or more paragraphs).
    There are usally dozens of elements within the body

The <html> Element

1.The element has a start tag <html> and an end tag </html>
2.The element content is another HTML element (the body)


Don't Forget the End Tag

<p>This is a paragraph
<p>This is another paragraph

The previous example will work in most browsers, but don't rely on it.
Forgetting the end tag can produce unexpected results or errors.

Empty HTML Elements

HTML elements without content are called empty elements.
<br> is an empty element without a closing tag. It defines a line break.

Adding a slash to the end of start tag, like <br/>, is the proper way of closing empty elements, accepted by HTML and XML.

No comments:

My Favorite Books

  • C and Data Structures by Ashok N. kamthane
  • Web Technologies by A. A. Puntambekar
  • Learn HTML and CSS with W3Schools
  • Learn JavaScript and Ajax with W3Schools
  • HTML5 Black Book: Covers Css3, Javascript,XML, XHTML, Ajax, PHP And Jquery
  • HTML5 Application Development Fundamentals: MTA Exam 98-375
  • .NET 4.0 Programming 6-In-1, Black Book
  • SQL Server 2008 R2 Black Book
  • Asp.net 4.0 Projects Covers: net 3.5 And .net 4.0 Codes, Black Book
  • UNIX Shell Programming 1 Edition by Yashavant Kanetkar
  • UNIX and Shell Programming 1 Edition by Richard F. Gilberg, Behrouz A. Forouzan
  • Computer Networks by Andrew S. Tanenbaum
  • Multiple Choice questions in computer science by Timothy J Williams