Hi <input type="text" name="txt1" /> HTML: Is it a standard to use double-quotes (") or are single-quotes allowed too (by W3C standards) ? <input type='text' name='txt1' /> HTML: Thanks
modern browsers seem to render with single-quotes too. But is it acceptable by W3C standards ? Blogger's XML templates uses single quotes for HTML attributes. If you check out any blogger powered blog, its mostly within single-quotes.
Both are fine. The important thing is that whichever you choose, be consistant. As far as I know, there is no recommendation either way. I personally use double quotes. Quotes within quotes, then, as when you have some Javascript inside parentheses, should be single. If you are writing your page in single quotes, then the inner quotes would be double. OnSubmit="something ('andotherstuff', 'more stuff', 'etc')"
Reason behind this is to embed php variables into html neatly - without so many backslashes. $html .= "<input name='{$this->name[$key]}' type='text' value='{$this->value[$key]}'/>"; PHP: Since blogger blogs use single-quotes, instead of double, I was hoping it to be W3C xHTML complaint. Thanks
I don't think the validator will know what the heck all that is. What you do is let the php send that to a browser, let the browser render it, then copy the (now xhtml) source into a text file and send THAT to the validator. As far as I know it's made to validate html, not php. So I don't know what it does when it sees a $ floating around. Or you could just send what you've got to the validator now and see what it says. If it understands php the quotes should be fine. type="text" and type='text' should be the same thing to the validator; type=text is wrong. It looks like you're doing the right thing: main quotes are doubles, inner quotes are singles. Your HTML will render showing singles. So, make sure everything that renders stays singles and you should be okay. By the way, if that input's in a form, it should have an id too which matches a label's "for". But that's just a side thing.