+ 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.

22nd Feb 2019, 4:00 PM
FirstSoloKiller
FirstSoloKiller - avatar
18 ответов
+ 27
They Means Generally!!!👍😊✌
24th Feb 2019, 5:19 PM
K͜͡ɩnɢ・ムzizi 🖤
K͜͡ɩnɢ・ムzizi 🖤 - avatar
+ 26
Thank You FirstSoloKiller For Choosing My Answer As Best!!!👍😊🤗👌✌
24th Feb 2019, 5:30 PM
K͜͡ɩnɢ・ムzizi 🖤
K͜͡ɩnɢ・ムzizi 🖤 - avatar
+ 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/
23rd Feb 2019, 6:18 AM
Anthony Williams
Anthony Williams - avatar
+ 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
22nd Feb 2019, 4:09 PM
Maneren
Maneren - avatar
+ 6
My understanding is that only html elements can have attributes and that comment tags and the doctype declaration are not really html elements.
28th Feb 2019, 4:32 AM
Sonic
Sonic - avatar
+ 6
<!--......--> it's a comment and a comment doesn't need to have any attribute.☺️ And <!DOCTYPE> is a declaration. ~Happy coding.
26th Aug 2020, 6:02 AM
Sakshi💕
Sakshi💕 - avatar
+ 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.
23rd Feb 2019, 5:38 AM
Codenerd
Codenerd - avatar
+ 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
24th Feb 2019, 5:57 AM
Rakibul Yeasin
Rakibul Yeasin - avatar
+ 4
<! DOCTYPE html>is a declaration. By this code browser will understand HTML version 5.0
23rd Feb 2019, 10:53 AM
keshav poudel
keshav poudel - avatar
+ 4
Anthony Williams is right
24th Feb 2019, 1:56 AM
John Asaolu
John Asaolu - avatar
+ 1
Why it is not running if we are changing mathod name as open instead of main
24th Feb 2019, 6:10 AM
RaaHul Kaurav
+ 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.
25th Feb 2019, 10:42 PM
Precious
Precious - avatar
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
22nd Dec 2019, 6:09 AM
kay cruz
kay cruz - avatar
0
It begins how can it get attributes
12th Jun 2020, 2:38 AM
Chris Happy
Chris Happy - avatar
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.
26th Aug 2020, 5:19 PM
kay cruz
kay cruz - avatar
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.
19th Oct 2020, 8:33 PM
thetechguy
thetechguy - avatar