Curriculum
Course: HTML Basic
Login

Curriculum

HTML Basic

HTML Introduction

0/1

HTML Editors

0/1

HTML Attributes

0/1

HTML Paragraphs

0/1

HTML Formatting

0/1

HTML Comments

0/1

HTML Favicon

0/1

HTML Page Title

0/1

HTML Iframes

0/1

HTML Java Script

0/1

HTML File Paths

0/1

HTML Symbols

0/1
Text lesson

Omitting html and body ?

An HTML page can still validate even if the <html> and <body> tags are omitted.

Example

<!DOCTYPE html>
<head>
  <title>Page Title</title>
</head>

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

It’s highly recommended to include the <html> and <body> tags, as omitting them may cause errors in older browsers and potentially crash DOM and XML software.

Omitting <head>?

The HTML <head> tag is optional.

Browsers automatically append all elements before <body> to a default <head> element if the <head> tag is omitted.

Example

<!DOCTYPE html>
<html>
<title>Page Title</title>
<body>

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

</body>
</html>

Nevertheless, we advise employing the <head> tag.

Close Empty HTML Elements?

Closing empty elements in HTML is optional.

Allowed:

<meta charset=”utf-8″>

Also Allowed:

<meta charset=”utf-8″ />

If you anticipate XML/XHTML software accessing your page, ensure to include the closing slash (/) as it’s mandatory in XML and XHTML.

Add the lang Attribute

Including the lang attribute within the <html> tag is essential as it declares the language of the web page, aiding search engines and browsers in proper interpretation.

Example

<!DOCTYPE html>
<html lang=”en-us”>
<head>
  <title>Page Title</title>
</head>
<body>

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

</body>
</html>