The value of the attributes need not to be enclosed within double inverted commas? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The value of the attributes need not to be enclosed within double inverted commas?

I have tried giving the width 60% without double inverted commas and it worked. So can anyone explain this?

13th Aug 2018, 5:38 PM
Saquib Nasim
Saquib Nasim - avatar
1 Answer
+ 2
From the W3C HTML5 working draft: https://www.w3.org/TR/2011/WD-html5-20110525/introduction.html Down the page, where Attributes are discussed... "The attribute value can remain unquoted if it doesn't contain spaces or any of " ' ` = < or >. Otherwise, it has to be quoted using either single or double quotes." [meta] Note that "spaces" actually refers to more than just the space you're accustomed to typing (ASCII 32); it includes several more. Search for "The space characters, for the purposes of this specification, are" ... in section 2.5: https://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html
13th Aug 2018, 5:54 PM
Kirk Schafer
Kirk Schafer - avatar