Tag!! htm tags

greenspun.com : LUSENET : Current News - Homefront Preparations : One Thread

Little Known Tag Attributes

By now you all know that HTML Tags can carry "attributes" that can alter the effect of the particular tag. For example, the Image tag can carry attributes for alignment, sizing, spacing, etc. Since there are so many tag attributes, we are often astonished to find new ways of using tags by incorporating their various sub-functions.

Here are some of the lesser known, but handy, attributes of common HTML tags that you may not be familiar with. There are tons of HTML resources out there where you can brush up on your HTML skills. You may be pleasantly surprised to find new ways of using old tags. For example:

IMG Tag: hspace and vspace — these attributes carry values in pixels that offset images from other elements on the page. Try it out for yourself by adding an image with an hspace=10 and vspace=15. See how the image is separated by that space at top and bottom, or on each side?

TD Tag: nowrap — This is a terrific way to make sure your table cells don't wrap. Add attributes to your cells to make sure text stays all on one line.

DIV Tag: (works with SPAN also) align=justify — This is kind of fun. You can justify text with divs and spans, meaning all text will appear as a solid block. Alternatively, you can specify right, left or center.

HREF Tag: Target — All webmasters should know that HREFs can be "targeted" to new windows or parent frames, whatever is called for. This is a good idea when working with advertisements, or if you have links inside frames or smaller windows. Simply use "target="_blank" to send your outgoing clicks to a new browser window.

SPAN Tag: contenteditable — This is crazy! Try adding the attribute contenteditable="true" ... you guessed it, now your visitors can type right over your HTML on screen. We're not sure what this is particularly useful for, but it's a lot of fun!

SPAN Tag: line-height — We liked this one so much, we thought we'd pass it along. Use line-height inside a span tag, such as: . This causes a "leading" or spacing of the text at 150% of normal. Ideal for spacing out text vertically.

-- Anonymous, April 01, 2002


Moderation questions? read the FAQ