If i am ending head before​ title then also its working same ?? Then what's a difference ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

If i am ending head before​ title then also its working same ?? Then what's a difference ??

<html> <head> <\head> <title> <\title> <body> <\body> <\html> and <html> <head> <title> <\title> <\head> <body> <\body> <\html> are these both are same ?? if not then why their working same in my laptop ??

10th Apr 2017, 9:57 PM
Ashiesh Watts
Ashiesh Watts - avatar
6 Answers
+ 15
It's a bad practice. Information that are not shown in the browser should be in head. If you right click in the browser window and select "view page source ", you'll notice that the browser will mark the title tag in red color.
10th Apr 2017, 10:38 PM
Wisdom Abioye
Wisdom Abioye - avatar
+ 9
@Ashiesh Watts, try the latest version of Firefox.
13th Apr 2017, 4:37 PM
Wisdom Abioye
Wisdom Abioye - avatar
+ 7
It's mainly depends on browser: Html is permisive ( purpose is to display Html page content as well as possible ), so browsers try to correct incorrect code silently... In major cases, <title> outside <head> may probably be corrected and moved into <head> internally... but it's more than 'bad' practice, it's 'wrong' practice, and should be avoided, as you cannot predict behavior in such cases ^^
11th Apr 2017, 2:14 AM
visph
visph - avatar
+ 4
As Visph said, it might work in some cases, but it becomes unpredictable and it might not work on some browsers. Besides that, you can get used to writing bad HTML and then the problem escalates.
13th Apr 2017, 4:49 PM
Abner Schmidt
Abner Schmidt - avatar
+ 3
Thank u Sir (Wisdom nd visph )... Actually I am new in coding and I am using Chrome browser it is not showing difference even in "view page source" also...So Please Guide which browser should I use instead of this....will be very thankful to you
13th Apr 2017, 4:27 PM
Ashiesh Watts
Ashiesh Watts - avatar
+ 2
@Wisdom Abioye....Thank u Sir...it's working
13th Apr 2017, 4:48 PM
Ashiesh Watts
Ashiesh Watts - avatar