| inline css attributes - with " marks or without?
|
santapaws

msg:4321496 | 10:42 am on Jun 3, 2011 (gmt 0) | in my html4/loose pages i always thought itw as correct specify class with an apostrophe such as class="this". I now see that minified code removes the apostrophe and leaves it as class=this. Same thing for height and width height=45 rather than height="45". If the apostrophe is not required why do we use it? it is ok to remove this and minify html site wide. perhaps it was just an old browser issue?
|
rocknbil

msg:4321619 | 5:01 pm on Jun 3, 2011 (gmt 0) | In XML (and likely XHTML?) quoting is required for valid parsing. From the spec [w3.org], | In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them. |
| So really, I think, it's the browser that's allowing you to get away with it by parsing them when they aren't quoted. As a test, try "minifying" a page with name='Big "Bill" Coder' It will likely leave those quotes in. Minifying code removes the quotes to reduce the size of the document, it adds a lot of bytes when quoted. :-) I prefer to collect savings elsewhere.
|
|
|