+ 22
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.
18 Answers
+ 27
They Means Generally!!!👍😊✌
+ 26
Thank You FirstSoloKiller For Choosing My Answer As Best!!!👍😊🤗👌✌
+ 23
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/
+ 14
<!-- 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
+ 6
My understanding is that only html elements can have attributes and that comment tags and the doctype declaration are not really html elements.
+ 6
<!--......--> it's a comment and a comment doesn't need to have any attribute.☺️
And <!DOCTYPE> is a declaration.
~Happy coding.
+ 5
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.
+ 5
<!-- --> 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
+ 4
<! DOCTYPE html>is a declaration. By this code browser will understand HTML version 5.0
+ 4
Anthony Williams is right
+ 1
Why it is not running if we are changing mathod name as open instead of main
+ 1
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.
0
comments are not considered tags are doctypes is declaration so the browser can know what type of html is to be rendered or checked if you run it in a validator
0
It begins how can it get attributes
0
comments and declarations arent technically tags...comments are used in various ways but never as a tag...because technically tags are elements/nodes which can be manipulated in the DOM...declaration is purely just info for the browser.
0
Technically, <!— —> and <!DOCTYPE html> are not html elements.
Comments (<!— —>) do not display any form of information in the code. And neither does the DOCTYPE ‘tag’. You might think ‘Why does the html tag have an attribute even though it does not show anything?’ but that is because the html tag is the root of the document which means you can have and onload attribute.