Introduction to HTML


What is HTML?

  • HTML stands for HyperText Markup Language. It’s the standard markup language used to create and structure content on the web.HTML uses a set of tags to define the structure and elements of a webpage.
  • An HTML document consists of nested elements. The basic structure includes a <!DOCTYPE> declaration, <html> tag, <head> section, and <body> section.

Structure of an HTML Document

  1. HTML Tags and Elements
    • Tags are used to define elements in HTML.
    • An HTML element consists of an opening tag, content, and a closing tag (e.g., <tag>content</tag>).
    • Commonly used tags include headings (<h1> to <h6>), paragraphs (<p>), and line breaks (<br>).
  2. HTML Comments
    • You can add comments in HTML to annotate your code.
    • Comments are not displayed in the browser but are helpful for documentation.
  3. Whitespace and Indentation
    • HTML doesn’t care about extra whitespace, but consistent indentation improves code readability.
    • Use spaces or tabs to indent your code consistently.
  4. HTML Attributes
    • Attributes provide additional information about elements.
    • They are placed within the opening tag and modify the element’s behaviour or appearance.
  5. Basic HTML Document Example
    • A simple example demonstrating the structure of an HTML document.
    • Includes the <html>, <head>, and <body> sections.
  6. Viewing HTML in a Browser
    • How to view HTML documents in a web browser.
    • Browsers render the HTML content and display it visually.

Leave a Reply

Your email address will not be published. Required fields are marked *