HTML Fundamentals

Learn to structure and annotate web documents using the standard markup language for websites and web applications.

🚘 Get Started

What is HTML?

HTML (Hypertext Markup Language) is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) to control layout and appearance, and scripts which control dynamic behavior within the web page.

This tutorial will guide you through the essential HTML elements, syntax, and best practices.

HTML Building Blocks

Tags

HTML elements are the building blocks of HTML pages. Almost everything is embedded within tags. A tag usually corresponds to a word or a phrase within an HTML document.

<title>This is a web page</title>
                                    

Attributes

Attributes provide additional information about the HTML element. They are always specified in the start tag.

<img src="image.jpg" alt="Descriptive text">
                                    

Basic Page Structure

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Page Title</title>
  </head>
  <body>
    <h1>Header</h1>
    <p>This is a paragraph.</p>
  </body>
</html>
                        

Every HTML document contains a basic template structure, as shown above. The <html> element is the root of the document, the <head> provides meta information, and the <body> contains all the content visible on the page.

Try HTML

  • HTML

Hello World

This is a paragraph

Edit the HTML code above and see the result in the preview panel.

HTML Semantics

Headings

Use heading elements to create page titles and subheadings. There are six levels of headings from h1 to h6.

<h1>Main Title</h1> <h2>Subheading</h2>

Paragraphs

The paragraph element represents a paragraph of text. A paragraph typically consists of one or several sentences, drawn from a larger body of text.

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