How can i specify SHORTTAG YES?


I get this error from the validator :

Line 26 column 112: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified.
..."><tr><td valign="top"><table border=0 width=100% cellspacing=0 cellpadding=0...

I know i should have something like this " border=‘0’ ", but i would prefer to leave the numeric values as is. How can this be done ? Is there a way to specify SHORTTAG YES somewhere in the document, and after that not to deal with this issue ?

Many thanks in advance.

Use this doctype:


It’s a badly written error message.

You have two choices: either switch to HTML 4.01 (there’s nothing wrong in doing that) or make your code be valid X(HT)ML. (Technically there’s a third choice, but doing so is very bad for the health of the web. If you choose to use XHTML, you must write valid code.)

Edit: Simon, why do you recommend a doctype that doesn’t include a URL?

SHORTTAG YES is declared in the SGML declaration for HTML (but not for XML). It is not something you can change.

In XHTML, all attribute values must be quoted.
In HTML, you may omit the quotation marks provided that your attribute value contains only letters (A-Z), digits, hypens, underscords, colons and periods.

Since the width attribute has the value 100&#37;, it must be quoted even in HTML.

thanks for the replies. I changed the DOCTYPE to html 4.01. I have to make valid html for a huge site with hundreds of files, and lots of errors(often the values ar not quoted). Are there any programs that are meant to do this automatically from php sources?

Because it’s shorter and does the same thing.

It doesn’t trigger standards mode in IE5/Mac though.

By the way, have you read “Designing with Web Standards”? It seems that Zeldman is wrong about some of the things he said regarding DOCTYPEs.

You’re right. That’s a bug in IE5/Mac. Who cares?



I’ve read the ALA article he wrote, which isn’t very accurate. What did he say about them in the book?[/ot]

Tell that to IE 6 when it whines about the lack of a link and starts throwing a temper tantrum (quirks mode).

Yeah. Doctypes don’t have links for starters.

Dan probably meant a URL. :stuck_out_tongue:

Unfortunately, I still do some projects where I am asked support IE5/Mac, so I have to care.


This is from the second edition, page 279.

He also pushes XHTML a lot and makes HTML sound outdated. He barely mentions the whole mime-type issue.[/ot]

Yup. I was using “plain conversational language” for once ;).

But lack of a “link” doesn’t put IE6 into quirks mode, unless you use a known legacy public identifier, such as e.g. HTML 4.01 Transitional. The doctype in #2 does indeed trigger standards mode in IE6.