Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Elements

0/1

HTML Attributes

0/1

HTML Headings

0/1

HTML Paragraphs

0/1

HTML Styles

0/1

HTML Formatting

0/1

HTML Quotation

0/1

HTML Comments

0/1

HTML Colors

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Block and Inline

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML - The Head Element

0/1

HTML Style Guide

0/1

HTML Entities

0/1

HTML Symbols

0/1
Text lesson

HTML Elements

HTML Elements

The HTML element encompasses all content between the start tag and the end tag.

<tagname>Content goes here…</tagname>

Examples of some HTML elements:

<h1>My First Heading</h1>
<p>My first paragraph.</p>

Start tag

Element content

End tag

<h1>

 First Heading

</h1>

<p>

  first paragraph.

</p>

<br>

none

none

Note: Certain HTML elements, such as the <br> element, lack content and are termed empty elements. They do not require an end tag.

Nested HTML Elements

HTML elements can be nested, which implies that elements can contain other elements within them.

Every HTML document comprises nested HTML elements.

The subsequent illustration comprises four HTML elements: <html>, <body>, <h1>, and <p>.

Example

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

Example Explained

The <html> element serves as the root element, defining the entirety of the HTML document.

It includes both an opening tag <html> and a closing tag </html>.

Within the <html> element, you’ll find the <body> element.

<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>

The <body> element outlines the body of the document.

It consists of both an opening tag <body> and a closing tag </body>.

Within the <body> element, there are two additional elements: <h1> and <p>.

<h1>My First Heading</h1>
<p>My first paragraph.</p>

The <h1> element specifies a heading.

It includes both an opening tag <h1> and a closing tag </h1>.

<h1>My First Heading</h1>

The <p> element delineates a paragraph.

It comprises an opening tag <p> and a closing tag </p>.

<p>My first paragraph.</p>

Never Skip the End Tag

Certain HTML elements will render correctly even if you overlook the closing tag.

Example

<html>
<body>

<p>This is a paragraph
<p>This is a paragraph

</body>
</html>

Nevertheless, it’s not advisable to depend on this behavior! Forgetting the closing tag may lead to unexpected outcomes and errors!

Empty HTML Elements

Empty elements in HTML have no content.

The <br> tag, which signifies a line break, is an example of an empty element that lacks a closing tag.

Example

<p>This is a <br> paragraph with a line break.</p>

HTML is Not Case Sensitive

HTML tags are insensitive to case: <P> is equivalent to <p>.

While the HTML standard doesn’t mandate lowercase tags, C7S suggests using lowercase in HTML and mandates lowercase for more rigorous document types such as XHTML.

 

Click to Learn