Formatting Text HTML
This lesson will discuss the main methods of formatting text.
- Tag HR - horizontal line.
- Tags H1..H6 - headers text.
- Tag P - paragraph.
- Tag BR - new line.
- Tags comment.
Tag HR creates a horizontal line and is used to visually selected text on the screen. Tag HR does not have a closing tag.
Tags H1, H2, H3, H4, H5, H6, create text captions. Headings isolated text information on the screen, enhancing its perception. Headings in HTML are different in the level (of importance). The largest headline - H1 ; the smallest headline - H6 .
Tag P forms a separate paragraph of the text. Default:
- Before paragraph is added to a small indentation.
- The paragraph is left-aligned.
- In the words placed one space, no matter how many of them delivered in HTML-code.
- Text wrapping to the next line occurs automatically if the word does not fit on the screen.
Tag BR starts a new line, it has no closing tag.
... <body> <h1>Title 1</h1> <h2>Title 2</h2> <h3>Title 3</h3> <h4>Title 4</h4> <h5>Title 5</h5> <h6>Title 6</h6> This line of text contains <br> a transition to another line. <p> This line of text formatted using the tag P. </p> <p>This line of text is underlined tag HR</p> <hr> </body> ...
Paragraphs give the text legibility and readability. Passage is an independent element of the HTML-page, and displayed separately from other items. These elements are called block . The paragraph in the HTML separates a small space from the previous and subsequent elements of HTML-pages. If a paragraph is placed entirely in the parent of the HTML-page, it will be displayed in one line - if not a paragraph is broken into multiple lines. In our example, the parent of the tag P is the tag BODY .
The code in HTML-page spaces and line breaks between the tags that create blocks did not appear in the browser window. Therefore, HTML-code can be formatted for ease of reading. For example, a good practice of writing HTML-code is to create indents to indicate the nesting tags.
For ease of reading large text is divided into headings that divide the text into paragraphs, chapters, sections. The level in the HTML header specifies how large a part of the text it begins.
- H1 opens the largest part of the text, which is usually the title of all HTML-pages. Title tier browser displays the largest font.
- H2 is used for a large section of HTML-pages.
- H3 is used for the head.
- H4, H5, H6 used for paragraphs. Title of the sixth level is displayed in bold, the same size as the text of the paragraph.
For an ordinary HTML-pages is enough titles of the first three levels. Headlines H4, H5, H6 are used for very large HTML-pages that have a complex structure.
Significantly expands the functionality of many Tagov their attributes . For example, consider the most frequently used attribute of align , which specifies the text alignment.
Attribute values align:
- center - text alignment centered;
- left - align text to the left (default);
- right - alignment of text to the right;
- justify - text alignment on width.
... <body> <h1 align="center">Title 1</h1> <p align="right"> The text is right-aligned </p> <p align="justify"> To paragraph text is aligned with the width it should be longer than one line. In this case, the browser automatically aligns the text to the left and right edges. Alignment is due to the addition of the "extra" space between slovamii. </p> </body> ...
In conclusion, this lesson will talk about the comments. Comments can not be processed by the browser, it ignores them. Comments are proprietary information for a web designer to facilitate his reading HTML-code. I should say that is the only comment tag in HTML, where the opening and closing tags are different:
- opening comment tag: <!--
- closing comment tag: -->
Anything between comment tags can not be processed by the browser. The text comments should be separated from the tag comment spaces.