Mobile app version of vmapp.org
Login or Join
Nimeshi995

: Is title tag position relevant in html pages? I'd like know if having the title tag positioned at the end of <head> tag or in any other position, always inside the <head></head>,

@Nimeshi995

Posted in: #Html #Title

I'd like know if having the title tag positioned at the end of <head> tag or in any other position, always inside the <head></head>, can lead to some kind of problem, I'm not talking about SEO stuffs, I'm talking about standards, browser rules, web application rules, or something like this.

I'd like to load a page from two different php file like this, is it a wrong way?

<!-- file1.php -->
<html>
<head>
....

<!-- file2.php -->
<title><?php echo($var)?>
</head>
<body>
...


<head> tag is not closed, because with the second file I dynamically add the <title> tag.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

3 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel560

The <title> element is required and it doesn't matter where it is put in the <head> section as long as it is beneath the character encoding declaration (i.e. <meta charset='utf-8'>). The character encoding declaration should always be the first element of the head section.

Furthermore, I will also say that <head> tags are optional, and so are <body> tags. It is safe to omit these tags from the HTML generated by PHP, as the browser will automatically know where these sections of the document start.

HTML5 specification on the title element: www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-title-element

10% popularity Vote Up Vote Down


 

@Shakeerah822

Browsers (and search engines) do not see PHP code. They only get the HTML document that has been produced by PHP software and sent by the server. So it does not matter how the content was originally divided between PHP files.

Similarly, all HTML specifications relate to the resulting HTML document, not to the tools used to generate it.

Within an HTML document, the title element may appear anywhere inside the head element. (In your example, it is the only element there.) I haven’t seen any reasons to expect that its placement there matters anything, though it is normal to put it before any other elements there except a meta element that declares the character encoding (since that declaration should appear as early as possible).

10% popularity Vote Up Vote Down


 

@Annie201

As for SEO it doesn't matter where in between the head tag the title tag is located. It's only rendered in the browser title bar. Google will change it occasionally if they feel they can build a better title than your page has for someone running a related search. There's not affect though on your website rankings based on the position of the title tag in the header. You can load as many files before and after it. Some examples are dynamically loaded CSS and JS files.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme