Tuesday, May 26, 2009

Some Extra Text Tags

. Tuesday, May 26, 2009

A few other tags to try out
Note: Many of these things can now be done using Cascading Style Sheets. These tags are only valid in older versions of the HTML specification.

There are a few more tags you might like to try while you are creating your pages. The tags I will be talking about in this section are <sub>, <sup>, <pre>, <nobr>, <wbr />, and the Netscape only <blink> tag.

<sub> and <sup>
These tags are used to place a number or words slightly above or below your normal text. The <sub> tag works like this:
Area<sub>1</sub>
The result is this:
Area1
And the <sup> tag allows you to use exponents if you need to:
x<sup>2</sup> + y<sup>2</sup> = 0
And this gives you:
x2 + y2 = 0
These two tags are most useful if you are writing mathematical equations and such on your page, but there are other times you may wish to use them.

The <pre> Tag
The <pre> tag is used when you want to keep the same amount of white space on your Web page as you have in your HTML code in your text editor. This may be useful when you have to post programming code. Here is an example:
<pre> x=1; y=2; if (x==1) y=2; </pre>
And this somewhat redundant code gives you this:
x=1;
y=2;
if (x==1)
y=2;
Notice how we didn't need to use <br /> or inside the <pre> tags. This can save you some headaches from writing in line breaks and spaces manually so often.

<nobr> and <wbr />
Any text you place between the <nobr> and the </nobr> tags will not break to the next line, even after reaching the end of someone's browser window.
Here is an example:

<nobr> I'll just keep writing like this for a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long time. </nobr>


When viewed on your Web page, this will be one really long line, like this:
I'll just keep writing like this for a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long time.

Unless you had a monitor with some pretty high resolution, you probably had to scroll to the right to see the end of that line. You can use the <wbr /> tag inside the nobr tags to force a line break if you want or need to do so, like this:
<nobr> I'll just keep writing like this for a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long <wbr /> long long long long long long long long long long long long long long long long long long long long long long long long long long long long time. </nobr>

Now you will have two lines that are not quite as long (though still pretty long in 640x480):
I'll just keep writing like this for a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long time.

The <blink> Tag
Yes, this is the tag everyone has been complaining about. If you are using Netscape (an older version) you can see the following reason why viewers get annoyed by this tag:
LOOK AT ME NOW!!!!!!

If you have IE, you won't see the text blink, but you can get the general idea. Actually, if the tag is used in a better way, it can help point out important things you want people to see. Just avoid the +10 font size... Here is an example:
This rule is <blink>very</blink> important!
This gives you the following:
This rule is very important!
Just use your own discretion when placing blinking text on your page, and remember it will only blink if your viewer is using Netscape (I think 2.02 - 4).
Well, that does it for this section. So, on we go to: HTML Comments.
www.pagesource.com

0 komentar:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Post a Comment

 
Namablogkamu is proudly powered by Blogger.com | Template by o-om.com