Useful (X)HTML Tags

There are some HTML and XHTML tags which are really useful that I hadn’t heard of until recently having a look at the W3Schools tutorial on HTML

The <pre> tag defines preformatted text (i.e. text which preserves spaces, new lines etc..) This can be useful if you have some text whose properties you want to keep

for int i = 0 to 10
print i
next i

The computer tags
Then we have a whole bunch of tags dedicated to displaying computer code and related artifacts. Tags like code (for computer code), kbd (for keyboard input), tt (for teletype text), samp (for sample text) and var (for computer variables. As far as I can tell, all of these, with the exception of the var tag, simply output the text in a monospace font while preserving the formatting (new lines and spaces). The var tag outputs slightly larger text which is bold and italic.

The address tag
The <address> tag is used to display addresses, such as the following

Donald Duck
BOX 555

Actually I don’t know why I put this one in the ‘useful’ category, I haven’t really seen it used much at all and it doesn’t seem too useful to me anyway, but you never know when it could come in useful

The abbreviations and acronyms tags
I really liked these tags and in fact it’s a shame they don’t get used more often. Especially in the Computer Science/IT fields. I can’t remember the amount of times I’ve been reading an article, tutorial, job description and had to google a acronym or abbreviation in order to figure out what’s being talked about.
e.g. <abbr>

e.g. <acronym>
As you can see, they’re kind of like the ‘alt’ tag of an image or a link.

The bdo (bi-directional override) tag
This has to be the coolest, least used feature of html. Essentially this tag allows you to display text backwards. By putting some text between <bdo dir=”rtl”> and the closing bdo tag, the text is reversed.

This text should display backwards.1234567890

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.