Take the 2-minute tour ×

HTML being the most widely used language (at least as a markup language) has not gotten its due credit.
Considering that it has been around for so many years, things like the FORM / INPUT controls have still remained same with no new controls added.

So at least from the existing features, do you know any features that are not well known but very useful.

Of course, this question is along the lines of:

Hidden Features of JavaScript
Hidden Features of CSS
Hidden Features of C#
Hidden Features of VB.NET
Hidden Features of Java
Hidden Features of classic ASP
Hidden Features of ASP.NET
Hidden Features of Python
Hidden Features of TextPad
Hidden Features of Eclipse

Do not mention features of HTML 5.0, since it is in working draft

Please specify one feature per answer.

comments disabled on deleted / locked posts

locked by Robert Harvey Mar 10 '12 at 3:52


36 Answers

That's only lowly related to HTML, but very few people know it.

People abuse the <meta> tag with the http-equiv attribute:

<meta http-equiv="Refresh" content="5; url=somewhere/"/>

However, many developers don't even know what this does. The http-equiv attribute means that the tag is meant to replace an HTTP header in cases where you aren't in control of them. Therefore, most work done through http-equiv should be done on the server side.

Besides, it's not as powerful: several properties of a document can't be changed through <meta> tags. Content-Type in a <meta> tag can tell the browser to use a certain charset, but most will ignore any change to the MIME type of the document (so you can't make a text/html document an application/xhtml+xml one that way).

Both tags from the example should be replaced by these simple calls:

header('Refresh: 5; url=somewhere/');

It's bound to work on any HTTP-compliant browser (which means, pretty much every single browser).

It should be noted that <meta http-equiv="Refresh" content="5; url=foo"> actually triggers a full page refresh in IE (including all cached assets). Can haz performance nightmare plx? blogs.msdn.com/b/ieinternals/archive/2010/05/13/… –  Mathias Bynens Jun 3 '10 at 20:51
@kibibu: That's quite possible, actually. I've been doing XHTML documents rather than HTML documents since long ago (I gave up on Internet Explorer about 3 years ago), so I put that information in the <?xml?> declaration at the top of the document: <?xml version="1.0" encoding="UTF-8"?> –  zneak Jun 4 '10 at 17:59
show 1 more comment

Superscript with <sup> x </sup>

add comment

A form can be submitted when you press the Enter key on a text input only if there is a submit button in the form. Try it here. It won't work if you don't change the type of the button to "submit".

This depends on the browser you are using. In HTML 2, a form containg just a text input SHOULD be submitted with enter. alanflavell.org.uk/www/formquestion.html –  Quentin Jun 5 '09 at 13:17
add comment

My favorite hidden feature was already mentioned, which is the "base" tag. Very handy for when you have a chunk of code that has relative URLs and suddenly they all move but your page doesn't.

But one that wasn't mentioned is the list header tag <lh>. It probably wasn't mentioned because it is considered "depreciated" but most browsers still support it. I don't know why it was phased out, nearly every unordered list I make could use a header, and it feels icky just dropping a h3 tag, and it feels just incorrect to make the first list item the title of the list.

show 2 more comments

Special characters for math, greek,... not known very well

And not really needed in a world with UTF-8 –  Quentin Jun 5 '09 at 8:49
Not really needed, but I for one prefer &pi; to &#960; –  Ant Jun 5 '09 at 9:04
I said UTF-8 not numeric character references. i.e. π –  Quentin Jun 5 '09 at 9:12
If you've looked up the entity on a list, then you can either transcribe the entity, copy and paste the entity or ... just copy and paste the character itself :) –  Quentin Jul 23 '09 at 9:36
Reading the source code back afterwards is rather easier if you have the actual characters in it too. –  Quentin Jul 23 '09 at 9:36
show 5 more comments

Definition lists:

  <dt>Some Term</dt>
  <dd>Some description</dd>
  <dd>Some other description</dd>

  <dt>Another Word/Phrase</dt>
  <dd>Some description</dd>

I've also retasked this for form layouts and navigation menus for various sites.

add comment
