TWO CONTRASTING HTML CHALLENGE QUESTIONS
Every html element can have an attribute. Ans: True Which of these html tags cannot have an attribute? Ans: <!doctype html> I think these questions contradict each other. What do you think?
6/3/2020 11:05:41 AM👑Tchybooxuur!
77 AnswersNew Answer
To paraphrase: What are doctypes, elements, attributes, and tags (and how do they relate to each other with respect to these challenge Q's)? Here's what WHATWG has to say (w3c copies the standards from them): https://html.spec.whatwg.org/dev/introduction.html#a-quick-introduction-to-html Notably: 'HTML documents consist of a tree of elements and text. Each element is denoted in the source by a start tag, such as "<body>", and an end tag, such as "</body>".' (Tags are used to mark up a document so browsers can understand where nodes begin and end in a document.) 'Elements can have attributes [...]' (Hmm... 'can' not 'all'...) 'DOM trees contain several kinds of nodes, in particular a DocumentType node, Element nodes, Text nodes, Comment nodes, and in some cases ProcessingInstruction nodes.' (DocumentType nodes seem to be a separate category from Element nodes.) https://dom.spec.whatwg.org/#concept-element 'Element nodes are simply known as elements.' (...Just so we're using the same terminology.)
I think the first one refers to html and not html 5 🤔
one of the many reasons I'll never do html challenges on the long run
👑Tchybooxuur! <!DOCTYPE HTML> is not a tag. It is a "header" to give information to the browser on what type of document to expect to render. Yes, <br>, <img> etc. are tags, so they are allowed to have attributes. <!DOCTYPE HTML> isn't a tag to begin with.
I guess it talks generally
When we say every, we generalise the elements in terms of most of them, not each of them. It is same as to saying, Generally, every element can have attributes, yet we know not all of them can have attributes... So, according to me, there is not much contradiction there
Alfred Juma See the meaning of "every" I got from Google. every /ˈɛvri/ determiner used before a singular noun to refer to all the individual members of a set without exception. "the hotel assures every guest of personal attention" Going by this definition, what you said might not be all that correct.
Yes you are Really right...how is this both situation can be true?
If we again review Html quizzes, then we shall get them to zero😂 Sebastian Pacurar 😝
👑Tchybooxuur! If you still think like it's wrong just go ahead and report the question
👑Tchybooxuur! What I think is the first question asks about the html 4 (and not html 5 )elements and since we don't need <!doctyp html> tag in html 4 , thus the question excludes it .
Explosive Creativity :D Yes, I understand. The question I'm asking is this: is <! doctype html> declaration also a html element? (Recall that not all the html elements require a closing tag). If yes, then the 2 questions are contrasting. Why can't it have an attribute?
I think It can not have attributes. <!DOCTYPE> is not a tag, it is a declaration/information that allows the browser to know what kind of document it will except.. Although I think the question should not include the word "tags" It should be like: Which of these cannot have an attribute? "It is only what I think..."
Janning⭐ Thanks a lot. Very educative stuff you contributed. You were mostly particular about clarity of terms and their definitions, I'd also like it if you gave your bit about whether the 2 questions on the post contradict each other...
Deepak Bhatt & Abeni Brando Thanks for contributions. I agree with you now. I learnt it on the thread.
👑Tchybooxuur! Well, atleast you got my point 😁😁
Explosive Creativity :D The question now is: Is <!doctype html> included in the set of every html elements as described in the question? I think it is... 🤔
We have tags and elements 😊 Figure it out on your own
Another similar point to note is that end tags cannot have an attribute, all attributes must be defined in the opening tags. Therefore, I don't also support the generalised opinion that all tags can have an attribute, but unfortunately that is how the question is☹
Element mean a set of opening and closing tags with or without content inside (As far as I have known). Tag = <justTag> Element = <openingTag>Content</closingTag> And it is also a fact that: <!DOCTYPE HTML> does not have a closing tag </!DOCTYPE HTML> SO BASICALLY IT IS A TAG AND NOT AN ELEMENT. THE QUESTION IS ABOUT ATTRIBUTES OF ELEMENTS AND NOT THOSE OF TAGS 😄😄😄