What declaration should all HTML files start with and what is the uses of it ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

What declaration should all HTML files start with and what is the uses of it ?

15th Nov 2018, 4:22 PM
Ratnapal Shende
Ratnapal Shende - avatar
10 Answers
+ 6
<!DOCTYPE HTML>
15th Nov 2018, 5:51 PM
Roneel
Roneel - avatar
+ 5
-;# <!DOCTYPE HTML> This declares this is a html file .. For different version you need to add some documentation of version's <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> But in this version html5 not necessary to add documentation... Browser already supports this is html documentation .
17th Nov 2018, 1:14 AM
mitthu0x01
mitthu0x01 - avatar
+ 4
This is what I have understood: This is declaration for HTML 5. For other version, it was pretty long and not necessary. It informs browser that doctype is HTML. And you need detailed explanation - wait for a moment. edit: see here https://www.w3schools.com/tags/tag_doctype.asp https://stackoverflow.com/questions/414891/what-is-doctype
15th Nov 2018, 6:04 PM
Roneel
Roneel - avatar
+ 3
you can use <meta> they are used for many things search you can search it online
16th Nov 2018, 9:26 AM
Raz Shneider
Raz Shneider - avatar
+ 3
<html> This is also an alternative It shows that the type is of a HTML Language.
16th Nov 2018, 3:35 PM
Stephen
Stephen - avatar
+ 2
<!DOCTYPE html> That's the declaration to use. It is a command telling the system that this code is html 5 or html 4 (the version). It is important to use it
16th Nov 2018, 4:17 PM
Ubong Umoh
Ubong Umoh - avatar
+ 2
In short, it defines the code.
16th Nov 2018, 4:19 PM
Stephen
Stephen - avatar
+ 2
<! DOCTYPE HTML>
17th Nov 2018, 4:56 PM
Rachit Sharma
Rachit Sharma - avatar
+ 2
Also add the meta charset as high as possible in your html page, since most browsers used to re-proces the whole page once they read the charset. Meaning everything read before could be thrown away in case it was read in the wrong charset.
19th Nov 2018, 11:48 AM
Koen Rockstars
Koen Rockstars - avatar
+ 1
<!DOCTYPE HTML> it tells the system that what is below is a html code
17th Nov 2018, 6:43 AM
Nzanana Cyusa Elite Carlson
Nzanana Cyusa Elite Carlson - avatar