Part 2: HTML Structure and Basic Tags



Understanding the Basic Structure of an HTML Document

Understanding the Basic Structure of an HTML Document

HTML is the language used to create web pages. Every web page has a basic structure consisting of the <html>, <head>, and <body> tags.

The Basic Structure of an HTML Document

The <html> tag defines the beginning and end of an HTML document. Everything inside this tag is part of the document. The <head> tag contains information about the document such as the title, keywords, and stylesheet. The <body> tag contains the content of the document such as headings, paragraphs, lists, images, and links.

The Most Commonly Used HTML Tags

  • <html> - defines the beginning and end of an HTML document
  • <head> - contains information about the document
  • <body> - contains the content of the document
  • <h1>, <h2>, <h3>, <h4>, <h5>, <h6> - create headings
  • <p> - create paragraphs
  • <ul>, <ol>, <li> - create lists
  • <img> - insert images
  • <a> - create links
  • <div> - divide content into sections

Adding Attributes to HTML Tags

Attributes provide additional information about HTML elements and can be used to add styling and functionality to your web page. Some commonly used attributes include:

  • class - assigns a class to an element for styling purposes
  • id - assigns an id to an element for targeting with CSS and JavaScript
  • style - adds inline styles to an element
  • src - specifies the URL of an image</
Exercise: Understanding the Basic Structure of an HTML Document

Exercise: Understanding the Basic Structure of an HTML Document

What are the three main sections of an HTML document?

  1. <html>
  2. <head>
  3. <body>

The three main sections of an HTML document are the <html>, <head>, and <body> sections.

Post a Comment