An Web Tells All About HTML What is HTML? Simple explanation: HTML is like the language that tells a computer how to build a webpage, kind of like building with LEGO bricks. For kids: It's the code that makes websites show up with words, pictures, and other cool things. Basic Concepts: Tags: HTML uses "tags" (like
for paragraph or
for a big title) to tell the computer what kind of content it is. Opening and Closing Tags: Most tags come in pairs, an opening tag (like
) and a closing tag (like
) that surrounds the content. Example:This is a paragraph.
This tells the computer to display "This is a paragraph." as a paragraph. Visuals: Show them examples with pictures and simple webpages to make it more concrete. How to introduce it: Start with the basics: Focus on a few simple tags like headings (), paragraphs (
), and maybe images ().
Make it playful: Use colorful examples and fun activities to keep them engaged.
Real-world examples: Show them how HTML is used on websites they already know.
Age-appropriate language: Avoid technical jargon and use simple, relatable terms.
Keep it short and sweet: Don't overwhelm them with too much information at once.
Encourage exploration: Let them experiment with simple code and see the results.
Remember to:
Keep it fun: Learning HTML should be an enjoyable experience for kids.
Be patient: Learning takes time, so celebrate their progress along the way.
Relate it to their world: Connect HTML to things they already enjoy, like online games or videos.
My Cat Is Very Grumpy
My Cat Is Very Happy
My Cat Is Very Sleepy
My Cat Is Very Hungry
My Cat Is Very Playful
My Cat Is Very Curious
My Cat Is Very Affectionate
My Cat Is Very Mischievous
The anatomy of our element is:The opening tag: This consists of the name of the element (in this example, p for paragraph), wrapped in opening and closing angle brackets. This opening tag marks where the element begins or starts to take effect. In this example, it precedes the start of the paragraph text. The content: This is the content of the element. In this example, it is the paragraph text. The closing tag: This is the same as the opening tag, except that it includes a forward slash before the element name. This marks where the element ends. Failing to include a closing tag is a common beginner error that can produce peculiar results.
Creating your first HTML element Let's give you some practice at writing your own HTML elements:
Click "Play" in the code block below to edit the example in the MDN Playground. Wrap the line of text with the tags and . To open the element, put the opening tag at the start of the line. To close the element, put the closing tag at the end of the line. Doing this should give the rendered text in the output panel italic text formatting. If you are feeling adventurous, try looking up some more HTML elements and applying them to the text example. If you make a mistake, you can clear your work using the Reset button in the MDN Playground. If you get really stuck, you can view the solution below the code block.
This is my text.
Nesting elements Elements can be placed within other elements. This is called nesting. If we wanted to state that our cat is very grumpy, we could wrap the word very in a element, which means that the word is to have strong(er) text formatting:
My cat is very grumpy.
There is a right and wrong way to do nesting. In the example above, we opened the p element first, then opened the strong element. For proper nesting, we should close the strong element first, before closing the p.
The following is an example of the wrong way to do nesting:
My cat is very grumpy.
HTML elements reference This page lists all the HTML elements, which are created using tags.
They are grouped by function to help you find what you have in mind easily. An alphabetical list of all elements is provided in the sidebar on every element's page as well as this one.
\textbf{Note:} For more information about the basics of HTML elements and attributes, see \textit{Anatomy of an HTML element}!
Main root Element Description
Represents the root (top-level element) of an HTML document, so it is also referred to as the root element. All other elements must be descendants of this element. Document metadata Metadata contains information about the page. This includes information about styles, scripts and data to help software (search engines, browsers, etc.) use and render the page. Metadata for styles and scripts may be defined in the page or linked to another file that has the information.Element Description
Specifies the base URL to use for all relative URLs in a document. There can be only one such element in a document. Contains machine-readable information (metadata) about the document, like its title, scripts, and style sheets. Specifies relationships between the current document and an external resource. This element is most commonly used to link to CSS but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. Represents metadata that cannot be represented by other HTML meta-related elements, like , , <script>, <style> and <title>. <style> Contains style information for a document or part of a document. It contains CSS, which is applied to the contents of the document containing this element. <title> Defines the document's title that is shown in a browser's title bar or a page's tab. It only contains text; HTML tags within the element, if any, are also treated as plain text. Sectioning root Element Description Represents the content of an HTML document. There can be only one such element in a document. Content sectioning Content sectioning elements allow you to organize the document content into logical pieces. Use the sectioning elements to create a broad outline for your page content, including header and footer navigation, and heading elements to identify sections of content.Element Description
Indicates that the enclosed HTML provides contact information for a person or people, or for an organization. Represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). Examples include a forum post, a magazine or newspaper article, a blog entry, a product card, a user-submitted comment, an interactive widget or gadget, or any other independent item of content. Represents a portion of a document whose content is only indirectly related to the document's main content. Asides are frequently presented as sidebars or call-out boxes. Represents a footer for its nearest ancestor sectioning content or sectioning root element. A typically contains information about the author of the section, copyright data, or links to related documents. Represents introductory content, typically a group of introductory or navigational aids. It may contain some heading elements but also a logo, a search form, an author name, and other elements.,
,
,
,
,
Represent six levels of section headings.
is the highest section level and
is the lowest.
Represents a heading grouped with any secondary content, such as subheadings, an alternative title, or a tagline.
Represents the dominant content of the body of a document. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application.
Represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. Common examples of navigation sections are menus, tables of contents, and indexes.
Represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it. Sections should always have a heading, with very few exceptions.
Represents a part that contains a set of form controls or other content related to performing a search or filtering operation.
Text content
Use HTML text content elements to organize blocks or sections of content placed between the opening and closing tags. Important for accessibility and SEO, these elements identify the purpose or structure of that content.
Element Description
Indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation. A URL for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the element.
Provides the description, definition, or value for the preceding term ( ) in a description list ( ).
The generic container for flow content. It has no effect on the content or layout until styled in some way using CSS (e.g., styling is directly applied to it, or some kind of layout model like flexbox is applied to its parent element).
Represents a description list. The element encloses a list of groups of terms (specified using the - element) and descriptions (provided by
- elements). Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).
- Specifies a term in a description or definition list, and as such must be used inside a
element. It is usually followed by a - element; however, multiple
- elements in a row indicate several terms that are all defined by the immediate next
- element.
Represents a caption or legend describing the rest of the contents of its parent element.
Represents self-contained content, potentially with an optional caption, which is specified using the element. The figure, its caption, and its contents are referenced as a single unit.
Represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section.
- Represents an item in a list. It must be contained in a parent element: an ordered list (
), an unordered list (), or a menu (). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.
A semantic alternative to , but treated by browsers (and exposed through the accessibility tree) as no different than . It represents an unordered list of items (which are represented by - elements).
Represents an ordered list of items — typically rendered as a numbered list.
Represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields.
Represents preformatted text which is to be presented exactly as written in the HTML file. The text is typically rendered using a non-proportional, or monospaced, font. Whitespace inside this element is displayed as written.
Represents an unordered list of items, typically rendered as a bulleted list.
Inline text semantics
Use the HTML inline text semantic to define the meaning, structure, or style of a word, line, or any arbitrary piece of text.
Element Description
Together with its href attribute, creates a hyperlink to web pages, files, email addresses, locations within the current page, or anything else a URL can address.
Represents an abbreviation or acronym.
Used to draw the reader's attention to the element's contents, which are not otherwise granted special importance. This was formerly known as the Boldface element, and most browsers still draw the text in boldface. However, you should not use for styling text or granting importance. If you wish to create boldface text, you should use the CSS font-weight property. If you wish to indicate an element is of special importance, you should use the element.
Tells the browser's bidirectional algorithm to treat the text it contains in isolation from its surrounding text. It's particularly useful when a website dynamically inserts some text and doesn't know the directionality of the text being inserted.
Overrides the current directionality of text, so that the text within is rendered in a different direction.
Produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.
Used to mark up the title of a creative work. The reference may be in an abbreviated form according to context-appropriate conventions related to citation metadata.
Displays its contents styled in a fashion intended to indicate that the text is a short fragment of computer code. By default, the content text is displayed using the user agent's default monospace font.
Links a given piece of content with a machine-readable translation. If the content is time- or date-related, the element must be used.
Used to indicate the term being defined within the context of a definition phrase or sentence. The ancestor
element, the
/ pairing, or the nearest section ancestor of the element, is considered to be the definition of the term.
Marks text that has stress emphasis. The element can be nested, with each nesting level indicating a greater degree of emphasis.
Represents a range of text that is set off from the normal text for some reason, such as idiomatic text, technical terms, and taxonomical designations, among others. Historically, these have been presented using italicized type, which is the original source of the naming of this element.
Represents a span of inline text denoting textual user input from a keyboard, voice input, or any other text entry device. By convention, the user agent defaults to rendering the contents of a element using its default monospace font, although this is not mandated by the HTML standard.
Represents text which is marked or highlighted for reference or notation purposes due to the marked passage's relevance in the enclosing context.
Indicates that the enclosed text is a short inline quotation. Most modern browsers implement this by surrounding the text in quotation marks. This element is intended for short quotations that don't require paragraph breaks; for long quotations use the element.
Element Description
Indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation. A URL for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the element.Provides the description, definition, or value for the preceding term ( ) in a description list ( ).
The generic container for flow content. It has no effect on the content or layout until styled in some way using CSS (e.g., styling is directly applied to it, or some kind of layout model like flexbox is applied to its parent element).Represents a description list. The element encloses a list of groups of terms (specified using the
- element) and descriptions (provided by
- elements). Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).
- Specifies a term in a description or definition list, and as such must be used inside a
element. It is usually followed by a
- element; however, multiple
- elements in a row indicate several terms that are all defined by the immediate next
- element. Represents a caption or legend describing the rest of the contents of its parent element. Represents self-contained content, potentially with an optional caption, which is specified using the element. The figure, its caption, and its contents are referenced as a single unit.
Represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section.- Represents an item in a list. It must be contained in a parent element: an ordered list (
), an unordered list (
), or a menu (). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter. A semantic alternative to
, but treated by browsers (and exposed through the accessibility tree) as no different than
. It represents an unordered list of items (which are represented by
- elements).
Represents an ordered list of items — typically rendered as a numbered list.
Represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields.
Represents preformatted text which is to be presented exactly as written in the HTML file. The text is typically rendered using a non-proportional, or monospaced, font. Whitespace inside this element is displayed as written.Represents an unordered list of items, typically rendered as a bulleted list. Inline text semantics Use the HTML inline text semantic to define the meaning, structure, or style of a word, line, or any arbitrary piece of text.
Element Description Together with its href attribute, creates a hyperlink to web pages, files, email addresses, locations within the current page, or anything else a URL can address. Represents an abbreviation or acronym. Used to draw the reader's attention to the element's contents, which are not otherwise granted special importance. This was formerly known as the Boldface element, and most browsers still draw the text in boldface. However, you should not use for styling text or granting importance. If you wish to create boldface text, you should use the CSS font-weight property. If you wish to indicate an element is of special importance, you should use the element. Tells the browser's bidirectional algorithm to treat the text it contains in isolation from its surrounding text. It's particularly useful when a website dynamically inserts some text and doesn't know the directionality of the text being inserted. Overrides the current directionality of text, so that the text within is rendered in a different direction.
Produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant. Used to mark up the title of a creative work. The reference may be in an abbreviated form according to context-appropriate conventions related to citation metadata.Displays its contents styled in a fashion intended to indicate that the text is a short fragment of computer code. By default, the content text is displayed using the user agent's default monospace font. Links a given piece of content with a machine-readable translation. If the content is time- or date-related, the element must be used. Used to indicate the term being defined within the context of a definition phrase or sentence. The ancestor
element, the/pairing, or the nearest section ancestor of the element, is considered to be the definition of the term. Marks text that has stress emphasis. The element can be nested, with each nesting level indicating a greater degree of emphasis. Represents a range of text that is set off from the normal text for some reason, such as idiomatic text, technical terms, and taxonomical designations, among others. Historically, these have been presented using italicized type, which is the original source of the naming of this element. Represents a span of inline text denoting textual user input from a keyboard, voice input, or any other text entry device. By convention, the user agent defaults to rendering the contents of a element using its default monospace font, although this is not mandated by the HTML standard. Represents text which is marked or highlighted for reference or notation purposes due to the marked passage's relevance in the enclosing context.Indicates that the enclosed text is a short inline quotation. Most modern browsers implement this by surrounding the text in quotation marks. This element is intended for short quotations that don't require paragraph breaks; for long quotations use theelement.