Loving the quirks


There are a couple things that I would like to point out in case anyone has any intention of developing for the web at any point. If you are trying to implement the standards - ie. HTML 4.01 or XHTML then let me notify you of a quirk with the Opera browser. For tags without explicit “closing” tags, you need to end the tag with a /. Example: <input type="checkbox" name="yesorno"/>. This is the way things are supposed to be done - fine. However if you want that checkbox to be checked off by default, then you need to add the checked parameter. You know this… great. However, where the quirk occurs is if you have the checked attribute last, unless you put a space before the /> at the end, Opera won’t recognize it. IE will, and I didn’t bother to check Mozilla. Of course if you don’t put the trailing slash in and care not about standards then you can go back to your business. For everyone else - please make note. FYI. This is how the above example should look if I wanted it checked by default. <input type="checkbox" name="yesorno" checked />

Dec. 7, 2004
The way to do it is actually: <input type="checkbox" name="yesorno" checked="checked" /> Note the value for the attribute of checked.

Sept. 4, 2014
With HTML 5 you don’t need the trailing slash. And you don’t need the ="checked" either. Oh the Internet… :)

Written by Colin Bate