|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Simple Question: Single or Double Quotes for Tag Attributes
Is there any kind of specification in the W3C guidelines that indicate whether or not double or single quotes should be used when specifying an attribute of an HTML tag? What about for XHTML?
I, as a practice, generally use double quotes but was just curious since both are so prevalent. |
|
#2
|
||||
|
||||
|
Either may be used, but double-quotes seem more common than single-quotes.
http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2 http://www.w3.org/TR/xhtml1/#h-4.4
__________________
Spreading knowledge, one newbie at a time. Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions IE7: the generation 7 browser new in a world of generation 8 browsers. Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around. |
|
#3
|
||||
|
||||
|
That kind of what I thought, thanks for the info
![]() |
|
#4
|
||||
|
||||
|
The option of using either style is a big help for those of us writing server-side applications that generate HTML. Sometimes the language will "make it difficult" to use one style or the other because they will have a meaning as a delimeter in the language.
__________________
print qq|Here I am\n| unless -e 'mySocialLife'; |
|
#5
|
||||
|
||||
|
I completely understand stonyt10 I run into that quite often in my development as well.
|
|
#6
|
||||
|
||||
|
I always use double quotes. When generating HTML server side I escape the double quotes \"
__________________
---| The Universe| |
|
#7
|
|||
|
|||
|
On the server-side I guess it depends on your application. Lots of ways to deal with it.
I prefer to use double-quotes as, to me anyway, it gives more definition to the code. |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Simple Question: Single or Double Quotes for Tag Attributes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|