HTML Basic Tags
Heading Tags
Heading Tags
Headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading.<h6> defines the least important heading.
Example
In its simplest form, following is an example of an HTML document
<!DOCTYPE html> <html> <body> <h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <h4>Heading 4</h4> <h5>Heading 5</h5> <h6>Heading 6</h6> </body> </html>
HTML Document Output
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Headings Are Important
- Search engines use the 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.
- headings should be used for main headings, followed by <h2> headings, then the less important <h3>, and so on.
Line Break Tag
Line Break Tag
The <br> tag inserts a single line break.
The <br> tag is an empty tag which means that it has no end tag.
Example
A line break is marked up as follows
<!DOCTYPE html> <html> <body> <p>To break lines<br>in a text,<br>use the br element.</p> </body> </html>
HTML Document Output
To break lines
in a text,
use the br element.
Nonbreaking Spaces
Nonbreaking Spaces
In cases, where you do not want the client browser to break text, you should use a nonbreaking space entity instead of a normal space.
Example
A line break is marked up as follows
<!DOCTYPE html> <html> <body> <pre> Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks <pre> </body> </html>
HTML Document Output
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks
Paragraph Tag
Paragraph Tag
The <p> tag offers a way to structure your text into different paragraphs. Each paragraph of text should go in between an opening <p> and a closing </p> tag
Example
In its simplest form, following is an example of an HTML document
<!DOCTYPE html> <html> <body> <p>Heading 1</p> <p>Heading 2</p> <p>Heading 3</p> </body> </html>
HTML Document Output
Heading 1
Heading 2
Heading 3
Headings Are Important
- Search engines use the 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.
- headings should be used for main headings, followed by <h2> headings, then the less important <h3>, and so on.
HTML Horizontal Rules
- The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.
- The <hr> element is used to separate content (or define a change) in an HTML page:
Example
In its simplest form, following is an example of an HTML document
<!DOCTYPE html> <html> <body> <h1>This is heading 1</h1> <p>This is some text.<p> <hr> <h1>This is heading 2</h1> <p>This is some text.<p> <hr> <h1>This is heading 3</h1> <p>This is some text.<p> <hr> </body> </html>
HTML Document Output
This is heading 1
This is some other text.
This is heading 2
This is some other text.
This is heading 3
This is some other text.
Preserve Formatting
Preserve Formatting
The <pre>tag defines preformatted text.
Text in a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.
Example
A line break is marked up as follows
<!DOCTYPE html> <html> <body> <pre> Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks <pre> </body> </html>
HTML Document Output
Text in a pre element is displayed in a fixed-width font, and it preserves both spaces and line breaks
0 Comments: