20 HTML Tags and Their Functions
HTML (HyperText Markup Language) is the foundation of web pages. It's used to structure content, add elements, and define the overall layout of a website. Here are 20 common HTML tags and their functions:
Basic Structure Tags
<html>
: Defines the root of the HTML document. Everything else goes inside this tag.<head>
: Contains metadata about the HTML document, such as the title, character set, and links to external stylesheets.<title>
: Specifies the title of the HTML document, which appears in the browser's title bar or tab.<body>
: Contains the visible content of the HTML document, including text, images, and other elements.
Text Formatting Tags
<h1>
to<h6>
: Defines heading levels, with<h1>
being the largest and most important heading and<h6>
the smallest.<p>
: Defines a paragraph of text.<br>
: Inserts a line break.<strong>
: Makes text bold.<em>
: Makes text italic.<pre>
: Preserves whitespace and formatting, useful for displaying code or text blocks.
Structural Tags
<div>
: A generic container element used to group other elements together and apply styles.<span>
: An inline container element used to group inline elements together and apply styles.<ul>
: Defines an unordered list.<ol>
: Defines an ordered list.<li>
: Defines a list item.<table>
: Defines a table.<tr>
: Defines a row in a table.<td>
: Defines a cell in a table.
Image and Multimedia Tags
<img>
: Inserts an image into the HTML document.<video>
: Embeds a video player into the HTML document.
Other Important Tags
<a>
: Defines a hyperlink.<form>
: Defines an HTML form for user input.<input>
: Creates an input field for user input.<button>
: Creates a button element.<script>
: Includes JavaScript code in the HTML document.
This is just a basic introduction to some common HTML tags. There are many more tags available, each with specific functions and uses. For a comprehensive understanding of HTML, it's essential to refer to the official W3C HTML documentation.