HTML Basics

Basic Syntax

HTML uses tags enclosed in angle brackets to define elements. Most elements have an opening tag <tagname> and a closing tag </tagname>, with content in between.

Nesting Elements

Elements can be nested inside other elements. It is important to properly close inner elements before closing the outer ones to maintain valid HTML structure.

<div>
  <p>This is a paragraph inside a div.</p>
</div>

Common HTML Tags

  • <h1>–<h6>: Headings
  • <p>: Paragraphs
  • <a>: Links
  • <img>: Images
  • <ul>, <ol>, <li>: Lists