For example, why is it <a href="https://en.wikipedia.org/wiki/Brown_bear">Learn More</a> but not <a href=https://en.wikipedia.org/wiki/Brown_bear>Learn More</a> I typed the attribute with no quotation marks and it still worked. What is the purpose of the quotation marks?
Wait, you put in the URL in without enclosing it in quotation marks (
"") and it let you pass? I'm pretty sure that should not be happening...
In HTML5 the rules that apply to HTML 4 also apply here. Quotes are optional if the document does not need to conform to XML (served as text/html). However, best practice recommends always quoting attribute values unless they are boolean.
HTML 4 is not XML compliant the way XHTML is. HTML5 can swing both ways. It can be text/html and follow HTML 4 rules (for the most part) or it can be application-xml in which the rules for XHTML apply.
As for the SCT allowing quoteless attribute values, it may have been overlooked by the course author. Best rule to follow? Use quotes, always.
Yeah, I typed the wiki link at first and forgot to include the quotation marks. It ran just fine. I got to the next page and it was a lesson on how to get the link to pop up on a new tab, and I caught the quotes that time. Is that not supposed to happen?
That is weird, My guess would be th--
... What he said.
Found with a google search
html Why do I need to have quotes in the attribute site:stackoverflow.com
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.