htmlnewbie23 Posted July 9, 2007 Share Posted July 9, 2007 This is a dumb beginner question but as I begin to learn how to write html, I've looked at some examples of existing webpages and have a question about tag attributes.On some pages tag attributes are entered in quotes, in others not so and in some it is a mixture, yet they all seem to display correctly and the same in my browser. For instance, I've seen:<hr size="5" noshade="noshade" width="10%"><hr size=5 noshade="noshade" width=10%><hr size="5" noshade=noshade width="10%">etc.When is inserting " " around an attribute necessary or required and when can they be skipped, if at all?Is the answer I will receive true for all tag attributes or specific to the <hr> tag.I do realize that these attributes are being downgraded in favor of styles, but I would still like to understand the quotations system. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 9, 2007 Share Posted July 9, 2007 For the sake of consistency, as well as the requirements of more recent specs, it is best to always quote all attribute values. Link to comment Share on other sites More sharing options...
pulpfiction Posted July 9, 2007 Share Posted July 9, 2007 Its not necessary to use double quotes for values of attributes in HTML but if you want to some XHTML standard then you need to have quotes for values...HTML: http://en.wikipedia.org/wiki/HTML [section 4.3]XHTML: http://en.wikipedia.org/wiki/Xhtml [section 1.2] Link to comment Share on other sites More sharing options...
htmlnewbie23 Posted July 9, 2007 Author Share Posted July 9, 2007 Its not necessary to use double quotes for values of attributes in HTML but if you want to some XHTML standard then you need to have quotes for values...HTML: http://en.wikipedia.org/wiki/HTML [section 4.3]XHTML: http://en.wikipedia.org/wiki/Xhtml [section 1.2]Thank you both. That is what I guessed, but I wanted to find out before going too far astray. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.