HTML Elements
HTML Elements
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ❯
HTML HOME
HTML Introduction
HTML Editors
HTML Basic
HTML Elements HTML Elements
HTML Attributes
HTML Headings ❮ Previous Next ❯
HTML Paragraphs
HTML Styles
HTML Formatting An HTML element is defined by a start tag, some content, and an end tag.
HTML Quotations
HTML Comments
HTML Colors HTML Elements
HTML CSS
HTML Links The HTML element is everything from the start tag to the end tag:
HTML Images
HTML Favicon <tagname>Content goes here...</tagname>
HTML Page Title
HTML Tables Examples of some HTML elements:
HTML Lists
HTML Block & Inline
<h1>My First Heading</h1>
HTML Div
HTML Classes
HTML Id <p>My first paragraph.</p>
HTML Iframes
HTML JavaScript Start tag Element content End tag
HTML File Paths
HTML Head <h1> My First Heading </h1>
HTML Layout
<p> My first paragraph. </p>
HTML Responsive
HTML Computercode <br> none none
Note: Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag!
COLOR PICKER
Nested HTML Elements
HTML elements can be nested (this means that elements can contain other elements).
The following example contains four HTML elements ( <html> , <body> , <h1> and <p> ):
ADVERTISEMENT
Example
<!DOCTYPE html>
<html>
<body>
</body>
</html>
Try it Yourself »
Example Explained
The <html> element is the root element and it defines the whole HTML document.
<body>
</body>
Then, inside the <body> element there are two other elements: <h1> and <p> :
ADVERTISEMENT
Example
<html>
<body>
<p>This is a paragraph
<p>This is a paragraph
</body>
</html>
Try it Yourself »
However, never rely on this! Unexpected results and errors may occur if you forget the end tag!
The <br> tag defines a line break, and is an empty element without a closing tag:
Example
<p>This is a <br> paragraph with a line break.</p>
Try it Yourself »
The HTML standard does not require lowercase tags, but W3C recommends lowercase in HTML, and demands lowercase for stricter document types like
XHTML.
HTML Exercises
Exercise:
Insert the correct end tag for the HTML heading.
<h1>This is a heading
Submit Answer »
Tag Description
For a complete list of all available HTML tags, visit our HTML Tag Reference.
❮ Previous Next ❯
W3schools Pathfinder
Track your progress - it's free! Sign Up Log in
ADVERTISEMENT ADVERTISEMENT
Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.