HTML
HyperText Markup Language (HTML) is the core language of the World Wide Web. It uses "tags" to annotate text, images, and other content for display in a web browser.
Contents
Syntax and Tags
HTML consists of elements usually comprised of an opening tag, content, and a closing tag. For example:
<tagname>Content goes here...</tagname>
Semantic HTML
Semantic HTML introduces meaning to the web page rather than just presentation. Common semantic tags include:
| Tag | Description |
|---|---|
<html> | The root element that wraps all content on the page. |
<head> | Contains metadata, titles, and links to scripts/stylesheets. |
<body> | Contains all the visible content of the document. |
<title> | Sets the title shown in the browser tab. |
<meta> | Defines metadata like character set, viewport, or keywords. |
<h1> to <h6> | Defines six levels of section headings. |
<p> | Represents a paragraph of text. |
<br> | Produces a line break in text. |
<hr> | Represents a thematic break (horizontal rule). |
<strong> | Indicates strong importance (typically rendered bold). |
<em> | Indicates emphasis (typically rendered in italics). |
<blockquote> | Represents a section quoted from another source. |
<pre> | Displays text in a fixed-width font, preserving whitespace. |
<span> | A generic inline container for phrasing content. |
<div> | A generic block-level container for flow content. |
<ul> | Defines an unordered (bulleted) list. |
<ol> | Defines an ordered (numbered) list. |
<li> | Represents an item within a list. |
<dl> | Defines a description list. |
<dt> | A term/name in a description list. |
<dd> | The description of the term in a description list. |
<a> | Creates a hyperlink to web pages, files, or locations. |
<img> | Embeds an image (self-closing). |
<video> | Embeds video content in the document. |
<audio> | Embeds sound content in the document. |
<source> | Specifies multiple media resources for video or audio. |
<iframe> | Embeds another HTML page within the current page. |
<form> | Creates a section containing interactive controls for user input. |
<input> | A versatile field for user data (text, checkbox, etc.). |
<label> | Provides a caption for a form element. |
<textarea> | A multi-line text input control. |
<button> | A clickable button to trigger actions. |
<select> | A drop-down selection list. |
<option> | Defines an item in a select list. |
<fieldset> | Groups related elements within a form. |
<legend> | Defines a caption for a fieldset. |
<table> | Represents tabular data. |
<tr> | Defines a row in a table. |
<th> | Defines a header cell in a table. |
<td> | Defines a standard data cell in a table. |
<thead> | Groups header content in a table. |
<tbody> | Groups the body content in a table. |
<header> | Introduction or navigational links for a page or section. |
<footer> | Information about a section like author, copyright, etc. |
<main> | The dominant content of the body. |
<section> | A generic standalone section of a document. |
<article> | Self-contained composition (like a blog post). |
<aside> | Content tangentially related to the main content. |
<nav> | Section intended for navigation links. |
<figure> | Encapsulates media and its caption. |