This forum is now read-only. Please use our new forums at

HTML Basics Forum

View Course » View Exercise

899 points
Submitted by
Manideep Lanka
almost 5 years ago

are the three rules mentioned compulsory?

the exercise says i should :
a. Always put <!DOCTYPE html> on the first line. This tells the browser what language it's reading (in this case, HTML).
b. Always put on the next line. This starts the HTML document.
c. Always put on the last line. This ends the HTML document.
i didn't follow any of the rules mentioned.i just typed some text,ran the code and it ran and showed the result! what does it mean? is it okay to skip the above rules?

3 votes


I think you should follow the instructions the author gives, when you start with html/php or any language you need to order your code so you find things easily, and you don´t have a mess in you files.

I have used html files with 600-700 lines and I can find everything because I have order in my work.

417 points
Submitted by
Jesús Cb
almost 5 years ago

3 votes


Those rules are very important, if you don't follow them then your code won't be written according to the standards, and basically, everything you write will be illegitimate. The exercise probably just passed because the Submission Correctness Test is faulty.

2200 points
Submitted by
almost 5 years ago


50b8cfffab86d27ec100177b_644765680 Manideep Lanka almost 5 years ago

oh.all right.thank you! hope codeacademy fixes such faulty exercises!

530c059a80ff3328610007df_714652390 Haley almost 5 years ago

No problem, and yes, I hope so too :)

3 votes


I'd like to expand a bit more on the subject, These rules aren't compulsory, these aren't rules at all. A website will render without them, but they are very important standard practices for HTML. The actual smallest HTML file is a text file saved as .htm or .html. These are however, like Dory said, very important practices which govern how browsers and servers should interpret the file.

Without those lines different browsers might treat the actual code differently or in fact not render it at all. These specific lines of code are standard practices for HTML 5. In HTML 4 and before for example the first line isn't required and in HTML 4.1 the first line tends to be huge!

So strictly speaking, this isn't in fact a compulsory rule, it is however very important for many many reasons from rendering to the fact that you'll be regarded as a very bad web designer if you should ignore those standards.

27 points
Submitted by
Shavit Mariposa Kamelgaren
over 4 years ago

1 Comment

50b8cfffab86d27ec100177b_644765680 Manideep Lanka over 4 years ago

thank you for that insightful reply Shavit!

0 votes


Always follow these rules. Unless of course, the above code is preset.

1210 points
Submitted by
almost 3 years ago