IT-rocks's Place

Don't forget HTML attributes

Sunday, July 20, 2008 by Thao Nguyen


HTML attributes are as important as the tags themselves. The following are some of the tag attributes that are not as common but can add value to your pages.

1. Anchor tag <a>
The anchor tag helps you to create links and bookmarks. This tag links the documents from all over the Internet. Those documents may be a picture, a webpage, a music file, or even a movie file.

The title attribute creates a title for a link. Browsers handle it with different ways, but the most popular way is to create a small popup window with the text in. It is used to provide more information to your readers without cluttering your webpages.

<a href="http://it-rock.blogspot.com/" title="Click here to go to my homepage">Designer's one-stop resource</a>

2. <hr>
<hr> tag is often to determine to width and size of the line.
noshade turns off the 3d effect to give you a solid line

<hr noshade="noshade" width="50" align="left" />

This attribute can also be achieved using the style attribute, by setting the color of the element

<hr style="color: #000; width: 50px; float: left;" />

Giving your line will make your pages look more effectively

<hr color="#ff0000" width="50" align="left" />

and can also be done with the style attribute

<hr style="color:#f00; width: 50px; float: left;" />

3. <body>
The body tag has many attributes, but there are several that allow you to manipulate how your page displays in the browser.

leftmargin
defines where the left margin should be in the browser. It's written in pixels, 0 puts it flush left. This attribute works only in Internet Explorer.

<body leftmargin="5">

Using the style attribute, you can set this for all modern browsers:

<body style="margin-left:5px;">

topmargin
this tag works the same as leftmargin, only it defines where the top of the page should be in the browser. Again, 0 pixels is flush with the top of the window. This is an attribute for Internet Explorer.

<body topmargin="5">

Using the style attribute, you can set this for all modern browsers:

<body style="margin-top:5px;">

marginwidth
the marginwidth attribute is Netscape's answer to leftmargin. Written in pixels it defines how close to the left margin the page will load.

<body marginwidth="5">

Using the style attribute, you can set this for all modern browsers:

<body style="margin-left:5px;">

marginheight also a Netscape attribute, the marginheight attribute defines how close to the top of the window the page should load.

<body marginheight="5">

Using the style attribute, you can set this for all modern browsers:

<body style="margin-top:5px;">

Check out the tags you're going to use to see if there are attributes that might give you more power over your page.

This information is taken from about.com

Related Posts by Categories



Filed under having  

Subscribe in a reader

Add to Technorati Favorites

0 comments: