- Learn HTML
- Welcome to Learn HTML! #
- Overview
- Overview of HTML
- Document structure
- Metadata
- Semantic HTML
- Headings and sections
- Attributes
- Text basics
- Links
- Lists
- Navigation
- Tables
- Forms
- Images
- Audio and Video
- Template, slot, and shadow
- HTML APIs
- Focus
- Other inline text elements
- Details and summary
- Dialog
- Conclusion and next steps
- Next and previous lessons
- HTML Basic Examples
- HTML Documents
- Example
- My First Heading
- The Declaration
- HTML Headings
- Example
- This is heading 1
- This is heading 2
- This is heading 3
- HTML Paragraphs
- Example
- HTML Links
- Example
- HTML Images
- Example
- How to View HTML Source
- View HTML Source Code:
- Inspect an HTML Element:
- HTML Basic Examples
- HTML Documents
- Example
- My First Heading
- The Declaration
- HTML Headings
- Example
- This is heading 1
- This is heading 2
- This is heading 3
- HTML Paragraphs
- Example
- HTML Links
- Example
- HTML Images
- Example
- How to View HTML Source
- View HTML Source Code:
- Inspect an HTML Element:
Learn HTML
This HTML course for web developers provides a solid overview for developers, from novice to expert level HTML.
Welcome to Learn HTML! #
Welcome to HTML! HyperText Markup Language, or HTML, is the backbone of the web, providing the content, as well as the structure of that content, that you see displayed in your web browser.
Unless you’re reading a PDF or a printed version of this page, this content is made up of various HTML elements and text. HTML is the content layer of the web. HTML elements are the nodes that make up the Document Object Model.
Cascading Style Sheets provide the look and feel, or presentation layer of the page. JavaScript is the behavior layer, often used to manipulate the objects within a document. Sites that are built with JavaScript frameworks are really just manipulating HTML. In turn, it’s important to mark up your HTML in a way that scripts can easily parse and that assistive technologies can easily understand. This means writing HTML code with modern standards.
Overview
This HTML course for web developers provides a solid overview for developers, from novice to expert level HTML. If you’re completely new to HTML, you will learn how to build structurally sound content. If you’ve been building websites for years, this course may fill in gaps in knowledge that you didn’t even know you had.
Along this journey, we will be building the structure for MachineLearningWorkshop.com. No machines were harmed in the creation of this series.
This is not a complete reference. Each section introduces the section topic with brief explanations and examples, providing you an opportunity to explore further. There will be links to topic references, such as MDN and WHATWG specifications, and other web.dev articles. While this is not an accessibility course, each section will include accessibility best practices and specific issues, with links to deeper dives on the topic. Each section will have a short assessment to help people confirm their understanding.
Overview of HTML
A brief introduction to the key concepts in HTML.
Document structure
Learn how to structure your HTML documents with a solid foundation.
Metadata
How to use meta tags to provide information about your documents.
Semantic HTML
Using the correct HTML elements to describe your document content.
Headings and sections
How to correctly use sectioning elements to give meaning to your content.
Attributes
Learn about the different global attributes along with attributes specific to particular HTML elements.
Text basics
How to format text using HTML.
Links
Everything you need to know about links.
Lists
Lists and other ways of grouping your content.
Navigation
Navigation is a key element of any site of application, and it starts with HTML.
Tables
Understanding how to use tables to mark up tabular data.
Forms
An overview of forms in HTML.
Images
An overview of images in HTML.
Audio and Video
Discover how to work with HTML media such as audio and video.
Template, slot, and shadow
An explanation of template, slot, and shadow.
HTML APIs
Learn how HTML information can be exposed and manipulated using JavaScript.
Focus
How to manage focus order in your HTML documents.
Other inline text elements
An introduction to the range of elements used to mark-up text.
Details and summary
Discover how the very useful details and summary elements work, and where to use them.
Dialog
The <dialog> element is a useful element for representing any kind of dialog in HTML, find out how it works.
Conclusion and next steps
Wrapping up with some further resources.
So, are you ready to learn HTML? Let’s get started.
This course was written by Estelle Weyl, with input and review from Rachel Andrew, and Jhey Tompkins.
Next and previous lessons
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies.
HTML Basic Examples
In this chapter we will show some basic HTML examples.
Don’t worry if we use tags you have not learned about yet.
HTML Documents
All HTML documents must start with a document type declaration: .
The HTML document itself begins with and ends with .
The visible part of the HTML document is between
and .Example
My First Heading
My first paragraph.
The Declaration
The declaration represents the document type, and helps browsers to display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The declaration is not case sensitive.
The declaration for HTML5 is:
HTML Headings
HTML headings are defined with the to tags.
defines the most important heading. defines the least important heading:
Example
This is heading 1
This is heading 2
This is heading 3
HTML Paragraphs
HTML paragraphs are defined with the
tag:
Example
This is a paragraph.
This is another paragraph.
HTML Links
HTML links are defined with the tag:
Example
The link’s destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
You will learn more about attributes in a later chapter.
HTML Images
HTML images are defined with the tag.
The source file ( src ), alternative text ( alt ), width , and height are provided as attributes:
Example
How to View HTML Source
Have you ever seen a Web page and wondered «Hey! How did they do that?»
View HTML Source Code:
Right-click in an HTML page and select «View Page Source» (in Chrome) or «View Source» (in Edge), or similar in other browsers. This will open a window containing the HTML source code of the page.
Inspect an HTML Element:
Right-click on an element (or a blank area), and choose «Inspect» or «Inspect Element» to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.
HTML Basic Examples
In this chapter we will show some basic HTML examples.
Don’t worry if we use tags you have not learned about yet.
HTML Documents
All HTML documents must start with a document type declaration: .
The HTML document itself begins with and ends with .
The visible part of the HTML document is between
and .Example
My First Heading
My first paragraph.
The Declaration
The declaration represents the document type, and helps browsers to display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The declaration is not case sensitive.
The declaration for HTML5 is:
HTML Headings
HTML headings are defined with the to tags.
defines the most important heading. defines the least important heading:
Example
This is heading 1
This is heading 2
This is heading 3
HTML Paragraphs
HTML paragraphs are defined with the
tag:
Example
This is a paragraph.
This is another paragraph.
HTML Links
HTML links are defined with the tag:
Example
The link’s destination is specified in the href attribute.
Attributes are used to provide additional information about HTML elements.
You will learn more about attributes in a later chapter.
HTML Images
HTML images are defined with the tag.
The source file ( src ), alternative text ( alt ), width , and height are provided as attributes:
Example
How to View HTML Source
Have you ever seen a Web page and wondered «Hey! How did they do that?»
View HTML Source Code:
Right-click in an HTML page and select «View Page Source» (in Chrome) or «View Source» (in Edge), or similar in other browsers. This will open a window containing the HTML source code of the page.
Inspect an HTML Element:
Right-click on an element (or a blank area), and choose «Inspect» or «Inspect Element» to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.