A html question problem

In a question it said that all html tags can have attributes but some tags example <!-- --> and <!Doctype html> can not have attributes.

2/22/2019 4:00:29 PM


13 Answers

New Answer


They Means Generally!!!👍😊✌


Actually, Aashka , it's not the root element. <html> is the root. The doctype declaration is known as a browser preprocessor instruction, and those do not permit attributes. Simple as that. More info here: https://html.com/tags/doctype/


Thank You FirstSoloKiller For Choosing My Answer As Best!!!👍😊🤗👌✌


Hey..!! <--!... --> it's a comment... So how it can have an attribute?? N <! Doctype HTML> It's the root of the whole HTML document... If u will add an attribute to it... Nothing will happen because it will not display on the output..!! Hope it helps.... :) ☺☺


<!-- Is comment tag --> so it has no attributes (what to set there) <!DOCTYPE html> tag specifies HTML5 pages so the browsers will undestand new tags


First let us look at what attribute is, ATTRIBUTE point at a direction of an Html ELEMENT, it tell us more information about HTML ELEMENT. Example of attribute is source (src) pointing at the direction of an image element (Img). <--!.....--> is a comment and doesn't need further details, so doesn't require attribute. Same for Doctype, is a declaration and so doesn't require further attribute.


<! DOCTYPE html> by this code browser will understand HTML version 5.0


Anthony Williams is right


<!-- --> is a comment. A comment doesn't need to have any attribute. And <!DOCTYPE html> is an instruction to the webbrowser about what version the HTML page is written in. Basically <!DOCTYPE html> means HTML5. HTML4 has three different declaration of <!DOCTYPE> See more at: https://www.w3schools.com/tags/tag_doctype.asp


My understanding is that only html elements can have attributes and that comment tags and the doctype declaration are not really html elements.


<!-- --> is of course a comment and has absolutely nothing to do with the output of your code. <! DOCTYPE html > is only used once and it is always the first element of the html document but won't run an attribute if any is added to it because to me, it only serves as the signature of an html file.


Why it is not running if we are changing mathod name as open instead of main


FirstSoloKiller you probably saw that while playing Sololearn's HTML challenge. Well, let me break it down: <!DOCTYPE html> means the DOCUMENT TYPE is html, and this kind of document declaration declares HTML 5. It is not an element to be closed or open. It is something semantic or something that gives meaning to the web page. You'll observe that right next to it comes the <html> tag which is always closed. You may write an html document without the doctype tag, it's just that, you haven't specified what "version of language you are speaking exactly." Likewise, the <!--...--> defines a comment, which is not displayed on the webpage nor affect it in ANY way (note, the 3 dots in signifies whatever thing you type in). Comments are used to explain codes and to make it easier to read. Imagine you have a code about 3000 lines, and you want to adjust something at one of the numerous forms input, commenting each codes will assist you in identifying what you want to correct easily and quickly.