Class 3 | Heading and Paragraph | Learn HTML
HTML Headings
Headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading.
<h6> defines the least important heading.
Headings Are Important
Use HTML headings for headings only. Don’t use headings to make text BIG or bold.
Search engines use your headings to index the structure and content of your web pages. Users skim your pages by its headings.
It is important to use headings to show the document structure. In HTML, h1 headings should be main headings, followed by h2 headings, then the less important h3, and so on.
HTML Horizontal Rules
The <hr> tag creates a horizontal line in an HTML page. The hr element can be used to separate content. See the following example:
<p>First paragraph.</p>
<hr>
<p>Second paragraph.</p>
<hr>
<p>Third paragraph.</p>
The HTML <head> Element
The HTML <head> element has nothing to do with HTML headings. The HTML <head> element contains Meta data. Meta data are not displayed. The head element is placed between the after <html> tag and the before starting the <body> tag:
<!DOCTYPE html>
<html>
<head>
<title>My HTML</title>
<meta charset="UTF-8">
</head>
<body>
The HTML <title> Element
The HTML <title> element is Meta data. It defines the HTML document’s title. The title will not be displayed in the document, but might be displayed in the browser tab.
<!DOCTYPE html>
<html>
<head>
<title>My HTML</title>
<meta charset="UTF-8">
</head>
<body>
The HTML <meta> Element
The HTML <meta> element is also meta data. It can be used to define the character set, and other information about the HTML document.
HTML Paragraphs
The HTML <p> element defines a paragraph. See the examples below:
<p>First Paragraph</p>
<p>Second Paragraph</p>
HTML Display
You cannot be sure how HTML will be displayed. Large or small screens and resized windows will create different results. With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML code.
The browser will remove extra spaces and extra lines when the page is displayed. Any number of spaces, and any number of new lines, counts as only one space.
HTML Line Breaks
The HTML <br> element defines a line break. Use <br> if you want a line break (a new line) without starting a new paragraph.
