DEV Community

Cover image for HTML5 Fundamentals
Pixel Mosaic
Pixel Mosaic

Posted on

HTML5 Fundamentals

Summary of the article

The article introduces the basics of HTML5 and explains the structure of an HTML document.

  • What is HTML5?

    • HTML (HyperText Markup Language) is the standard markup language used to create web pages.
    • HTML5 is the latest major version and introduces improved semantic elements that make web pages more meaningful and accessible.
  • How HTML works

    • HTML documents are organized as a tree of nested elements.
    • Elements consist of opening and closing tags and may contain attributes.
    • Example hierarchy:
    • <html>

      • <head>
      • <body>
      • <h1>
      • <p>
  • HTML tag anatomy

    • A typical element contains:
    • Opening tag
    • Optional attributes
    • Content
    • Closing tag
    • Attributes provide additional information such as class, id, or lang.
  • Void (self-closing) elements

    • Some HTML elements do not have closing tags, such as:
    • <img>
    • <link>
    • <meta>
    • <br>
  • Basic HTML5 document structure

    • The article explains the purpose of:
    • <!DOCTYPE html> – declares an HTML5 document.
    • <html> – root element.
    • <head> – metadata, title, CSS, scripts.
    • <body> – visible page content.
    • <header> – introductory content.
    • <nav> – navigation links.
    • <main> – primary page content.
    • <footer> – page footer.
  • Comments

    • HTML comments use:
    <!-- This is a comment -->
    
  • Best practices

    • Use proper indentation.
    • Use semantic HTML elements instead of generic containers where appropriate.
    • Keep only one <main> element per page.
    • Set the document language using the lang attribute.
    • Include essential metadata like character encoding and viewport settings.

The article concludes by introducing the rest of the HTML5 series, which covers semantic elements, text markup, multimedia, lists, and tables. ([dev.to][1])

[1]: https://dev.to/arthurassuncao/html5-fundamentals-and-basic-structure-a-beginners-guide-1igm?utm_source=chatgpt.com "HTML5 Fundamentals and Basic Structure: A Beginner's Guide.

Top comments (0)