Monday, August 17, 2009

TEXT FORMATTING IN HTML


<H1> TO <H6> : <h1> creates fist level heading. Its block level element it has six levels <H1> to <H6> it requires ending tag. It’s having ALIGN attribute having value like left, right, center, justify.


<P> …. </P>

<p> creates a paragraph, it’s a block level element its having attribute ALIGN having value like left, right, center, justify.

<PRE> … </PRE>

Creates a block of preformatted text so that you can arrange lines in a particular way to create text, most browsers will display the pre element using mono spaced font such as courier.

Attribute WIDTH to indicate the number of characters the widest line of the preformatted text has.

For example:

<html>

<head>

<title>first small program </title></head>

<body bgcolor=’red’ color=’white’>

<h1>Good morning……friends</h1>

<h2>Good morning……friends</h2>

<h3>Good morning……friends</h3>

<h4>Good morning……friends</h4>

<h5>Good morning……friends</h5>

<h6>Good morning……friends</h6>

<P align=’right’>

it suggests a shift in the ultimate power over HTML to the corporate players. From now on, you can probably assume that HTML extensions beyond what is generally considered HTML 3.0 will become standard on a case-by-case basis.

</p>

<p align=’center’>

It suggests a shift in the ultimate power over HTML to the corporate players. From now on, you can probably assume that HTML extensions.

</p>

<pre>

1          ram     100

2          sita      200</pre></body></html>

<TT> …</TT>

This element makes enclosed text appear in a fixed width , typewriter style font such as courier , its text level element.

<B> … </B>

This element made enclosed text bold, its text level element, you can also use <strong>  tag for doing same thing.

<I> …. </I>

This element made enclosed text italic, its text level element, you can also use <EM> tag for doing same thing.

<U> … </U>

This element made enclosed text underlined its text level element.

<STRIKE> … </STRIKE>

Makes the enclosed text appear with a strike out through the middle you can also use <S> tag but <strike> is widely supported than <s>, its text level element.

<SUB> … </SUB>

This element used to indicate a subscripted section for example NA<sub>2</sub> CO<sub>3</sub> will display output like NA2CO3. its text level element.

<SUP> … </SUP>

This element used to indicate a superscripted section for example E=MC<sup>2</sup> will display output like E=MC2. Its text level element.

For example :

<html>

<head>

<title>first small program </title></head>

<body bgcolor=’red’>

<B>Good morning……friends….</B><BR>

<I>Good morning……friends….</I><BR>

<U>Good morning……friends….</U><BR>

<I><U>Good morning……friends….</U></I><BR>

<STRIKE> Good morning……friends….</STRIKE><BR>

NA<sub>2</sub> CO<sub>3</sub><BR>

E=MC<sup>2</sup>

<TT>

it suggests a shift in the ultimate power over HTML to the corporate players. From now on, you can probably assume that HTML extensions beyond what is generally considered HTML 3.0 will become standard on a case-by-case basis.

</TT></body></html>


Programmer's HTML Tags

One of the early, more common uses for HTML was for documenting computer programs and offering tips or advice to computer programmers. Part of the HTML 3.0 standard, then, offers some implicit (logical) HTML tags that allow HTML designers to mark text in a way that makes it easier to present computer-programming codes. Those tags are listed in table below. Tags Meaning   Generally Rendered as…
























HTML Tags for Computer Programming  [All is text level element ]

<CODE> … </CODE>  

Programming lines  Monospaced  (like <TT>) 

<KBD> … </KBD>  

Keyboard text  Monospaced 

<SAMP> …  </SAMP>  

Sample output  Monospaced 

<VAR> …  </VAR>  

Variable  Italic


Notice that the majority of these tags are often displayed in exactly the same way-in the default monospaced font for the browser. Then why use them? First, not all browsers will necessarily follow the "general" way. Some browsers will actually render these tags in slightly different ways from one another, so that <SAMP>, for instance, might appear in a slightly larger font than <CODE>.  Second, using these tags is a great way to internally document your HTML pages, so that you can tell at a glance what certain text is supposed to be. This will help you later when you return to the document to update it or fix errors-especially as the document becomes more complex. 
































HTML Tags for Font formatting [All is text level element ]

<STRONG> … </STRONG>  

Make enclosed text bold

<SMALL> … </SMALL>   

Make enclosed text font size 1 pixel small

<BIG> … </BIG>  

Make enclosed text font size 1 pixel big

<BLINK> …  </BLINK>  

Make enclosed text blinking effect not supported by html 4.0

<EM>….</EM>

Make enclosed text italic.

<BLOCKQUOTE>...</BLOCKQUOTE>

Make block of quote for text


<FONT> … </FONT>

This element sets font size, color, face for enclosed text and it’s a text level element.




















Attributes of <FONT> … </FONT>

SIZE

This will set size of font. You have to specify the integer value

COLOR

This will set a color of font

FACE

This will set a type of font. You can give more than one type by separating it using coma.


For example, <font color=’red’ face=’verdana,Helvetica,arial’ size=8> world wide web </font>

<BASE>…</BASE>

This element indicates the location of a document and can set a default link target it’s a head section element.

















Attributes of <BASE> … </BASE>

HREF

This will give hyper reference for the file , required URL as value

TARGET

To indicate the full URL of the current document.



<BASEFONT>…</BASEFONT>

This element indicates the default font settings for the rest of the document. it will be automatically apply over the text for which you don’t write <font> formatting tag.




















Attributes of <BASEFONT> … </BASEFONT>

SIZE

This will set size of font. You have to specify the integer value

COLOR

This will set a color of font

FACE

This will set a type of font. You can give more than one type by separating it using coma.


The<FONT> and <BASEFONT> Tags

Ability unique to Netscape HTML (outside of style sheets) is specific control over the size of fonts. The general HTML theory is to allow a browser to decide what fonts will be larger than others, although it's safe to assume, for instance, that graphical browsers will render <H1> text larger than <H2>, etc.

Netscape, however, offers up the <FONT> and <BASEFONT> tags, which take the SIZE, attribute to change the size of browser fonts, regardless of the tags used. <BASEFONT> changes the font size for an entire document relative to the default. <FONT> can then be used to set individual font sizes within the document. They're formatted like this:

<BASEFONT SIZE="number">

<FONT SIZE="(+/-) number">

You'll want to use an incremental number (for example, +2) for the SIZE attribute to the <FONT> tag when you're using the <BASEFONT> tag to set the default. The <FONT> tag can be used just about anywhere in regular text. For instance:

<BASEFONT SIZE="4">

<P>We're having a S<FONT SIZE="+1">A<FONT SIZE="+2">L<FONT SIZE="+3">A<FONT SIZE="+4">BRA<FONT SIZE="+3">T<FONT SIZE="+2">I<FONT SIZE="+1">O<FONT SIZE="+0">N!</P>

 

You can use <FONT> as often as you'd like. Just remember that as a general rule, the more you use it, the more annoying it is.

No comments: