HTML is used to structure web pages using elements like headings, paragraphs, links, and images. HTML is the standard markup language for creating web pages, utilizing tags to define elements such as headings , paragraphs, lists , links , images , tables , and forms. The advent of HTML5 introduced semantic elements like header, nav, article, section, and footer, which enhance content organization, accessibility, and search engine optimization (SEO). HTML5 also supports multimedia elements like video, audio, a canvas for graphics, and APIs for features like geolocation, drag-and-drop, and local storage. HTML is widely used for static websites, web forms, landing pages, and as a foundation for dynamic applications when paired with JavaScript. Its versatility makes it indispensable in web development.
HTML uses tags wrapped in angle brackets to label content. Most tags come in pairs: an opening tag marks where something starts and a closing tag (with a forward slash) marks where it ends. The opening tag, the content, and the closing tag together form an element. Some elements are self-closing because they have no content to wrap — <img> just points to a file, <br> just creates a line break.
Attributes give extra information to a tag, written inside the opening tag as name="value" pairs. A link without href has nowhere to go. An image without src has no file to display. An image without alt is invisible to screen readers. Attributes turn a generic tag into something specific and meaningful.
Nesting means placing elements inside other elements. A list element <ul> contains list items <li>. A navigation section <nav> contains links <a>. This nesting builds a tree structure called the DOM (Document Object Model) that JavaScript can later access and modify.
HTML5 introduced semantic elements whose names describe their purpose: <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>. Using these instead of generic <div> tags makes code easier to read, improves accessibility for screen readers, and helps search engines understand the page structure.
| Tag | Description |
|---|---|
| <!DOCTYPE html> | Declares that this document is an HTML5 document. |
| <html> | The root element of the HTML page; all other elements go inside this. |
| <head> | Contains meta-information about the HTML page (not visible on page). |
| <title> | Specifies the page title, shown in the browser tab or title bar. |
| <body> | Contains all visible content like headings, paragraphs, images, links, lists, etc. |
| <h1> | Defines a large heading on the page. |
| <p> | Defines a paragraph of text. |
This is a paragraph created using HTML.