Some common tags

We have discussed the basic tags and their attributes needed for an HTML document. There are several other tags, with which web page contents can be made more attractive. Some of these tags are used for formating the text contents in the body section of the HTML document and therefore they are called formating tags. Now let us see some of them, which are essential for the layout of the body content.

<H1>,<H2>,<H3>,<H4>,<H5>and<H6> - Heading tags

A heading is a word,phrase, or sentence given at the beginning of a written passage that explains what it is about. Headings are typically displayed in a larger and / or bolder fonts than normal body texts. HTML has six levels of headings from <H1> to <H6>. Here <H1>creates the biggest text and <H6> the smallest. While displaying any heading, browser adds one line before and one line after that heading. The main attribute of this tag is Align and the possible values are,

Left      : Text is aligned to the left margin.
Right    : Text is aligned to the right margin.
Center  : Text is aligned to the center of the page.

Example shows different heading types and alignments and figure shows the corresponding web page.

To illustrate different heading tags

 

  <P> tag - Creating paragraphs

The <p> tag enables us to organise the text within the <BODY> tag into paragraphs. It indicates a new paragraph and instructs the browser to add a blank line before the paragraph. Paragraphs in HTML acts much like the paragraphs in any in any word processor. The paragraph element begins with the <P> tag and with </P>tag. The Align attribute sets the alignment of the text in the paragraph with the values left, right, center or justify.

The code given in example shows how paragraphs are designed with different alignments. Figure show the resultant web page.



In example, we can see that the source code contains three lines in the first paragraph and two lines in the second paragraph with extra space. But the web page of this code shown in figure gives a single line for the first two paragraphs. That is, the browser will remove extra space and extra lines when the page is displayed. Not that the second paragraph is right aligned and the third paragraph is aligned as justified. Any number of spaces and any number of lines count as only one space. Therefore with HTML, we cannot change the output by adding extra space or extra lines in the HTML code. But this is possible in HTML. Now let us discuss how an extra line cane be added to the text content using <BR> tag. Note that the web page obtained in large or small screens and resized windows may not match with the one given in figure.

<BR> tag - Inserting line break

The purpose of BR element is that it creates a line break within a block of text in a web page. The <BR> tag is used to break the current line of the text and continue from the beginning of the next line.  The <BR> tag is an empty tag, which means that it has on ending(closing) tag.

The HTML code in example display figure shows the resultant  page in which we can see the effect of <BR> tag and difference between <P> tag and <BR> tag.



Comments

Popular posts from this blog

List in HTML

Basic concept of HTML documents

Inserting image