Can id attributes only be used on <div> tags?

More like four. There are two with printable text plus newline, and two newlines.

Text - Web APIs | MDN

I tried it without quotes, but I didn’t see any error! why?

Show us your code and we might be better to answer why…

1 Like

That’s it:

HTML is raw text so everything is treated as character data. The browser can parse out the attribute value given the surrounding syntax, even when quotes are removed. This is only the case when the page is served as text/html. When served as XML all the soft rules go out the window.

Bottom line, don’t let yourself be in the habit of leaving quotes off the attribute values and it won’t come back to bite you.


What is XML? I know HTML stands for hypertext markup language so I would guess XML is some kind of markup langauge. Am I correct?

XML is the top of the food chain of markup languages. It heralds from SGML which it replaces as the standard bearer. It stands for, Extensible Markup Language and its chief role has been centered around data markup. A spreadsheet can be compared to XML if we consider the column headings being the tags, and everything in that column being marked up with that tag.

SGML is the grandfather of markup languages. It stands for Standard General Markup Language. Pretty well all markup languages trace back to that one.

If you have Media Player or iTunes, the data for those apps is wrapped in XML. Many other applications are also built around the language such as WYSIWYG editors like Dreamweaver, to name but one.

A web page is a form of data composition with a presentation element and scripted behaviors. The most obvious juxtaposition of XML in a web environment is the XHTML language of the late 90s. HTML5 has a flavor that conforms to the strictness of that markup (application/xml) but for the most part we use the HTML 4.0 flavor (text/html).

Bottom line, HTML only exists inside the declared root element and not outside of that, where the DTD lives.


Thank you for responding so quickly!

1 Like

What is node basically ?? since I got confused do we count the new lines as a node ??

Good question, and one to find more reading on. A node is essentially anything that can be isolated, so not only is an element a node, if it can contain text, then the text is also a node.

Try this search and see how W3C interprets a node, and its types.

1 Like

Wow, THANK YOU so so much for this information!!!

1 Like

Thank you Mia! It was helpful

This is really just the reply of all replies :pray: