ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Which is better to have anchor tag inside <h1> or <h1> inside achor tag?

I am trying to use &lt;h1&gt; tags on my site as page title but I want this title to be linkable .Which one is better in terms of SEO?

 

  • Case1:

&lt;h1&gt; &lt;a href=&quot;&quot;&gt; My Title &lt;/a&gt; &lt;/h1&gt;

  • Case2:

&lt;a href=&quot;&quot;&gt; &lt;h1&gt; My Title&lt;/h1&gt; &lt;/a&gt; 

 

user-image
تم إضافة السؤال من قبل Khadijah Shtayat , Technical Lead , Opensooq
تاريخ النشر: 2015/01/15
Rahaf Nawash
من قبل Rahaf Nawash , Front End Engineer , Atypon Systems Inc.

Case one is the correct one as h1 is a blocking element so it should not be inside a non blocking element ... This violates the html standards .. And would affect SEO as well.

Chandana Pathirage
من قبل Chandana Pathirage , System Development Manager IT , Vingrows Business Solutions (Pvt) Ltd

According to web standards you aren't allowed to put block elements into inline elements.

 

As h1 is a block element and a is an inline element the correct way is <h1><a href="#">My Title</a></h1>

 

In HTLM5 this has changed. Both examples will validate - validator.w3.org

Akram  Abbasi
من قبل Akram Abbasi

SEO (Search Engines) does not Prioritize that how you have used your tags but it checks your contents even your internal and external href links. like as following. And Tags best practice is checked by W3C.http://screencast.com/t/U6BRfBVYRAnd2nd thing If you are using General Css how it effects and if your priority is

 

than it should be in side the . http://screencast.com/t/g9ev1GyaG

 

Masoud DaneshPour
من قبل Masoud DaneshPour , Senior Developer , DAPA

It depends

If you are using the HTML5 there are not difference

if you are using non HTML5 the case2 is absolutely  wrong

Muhammad Waqas
من قبل Muhammad Waqas , Senior Web / Graphic Designer , Vital Solutions

This is the correct way

<h1><a href="#">My Title</a></h1>

Also use h1 for main heading only ....All the subheading should be h2, h3 etc. This is best SEO practice ;)

isra bazzar
من قبل isra bazzar , Web Developer - Freelancer , DimaTech

In HTML5 both cases are the same since it has block-level, otherwise in case1 you will get only the line "My Title" clickable, in case2 the whole h1 area will be clickable,   

But anyway I would use case 1 for easier code navigation and more neatness

 

Owais Jaffar
من قبل Owais Jaffar , Head of SEO and Social Media , Knowledge Path

Case One is the correct way as it complies with the HTML Standard.

Muhammad Haris
من قبل Muhammad Haris , Software Engineer , InventorX

Case1 is the better option.

Humza Khayyar
من قبل Humza Khayyar , Software Engineer , Beetechnica

I doesnot matter in term of SEO whatever way you choose but having tag in between anchor tag will be much better nd appropriate and it makes it difficult to get scanned in source code as well. case 2 (y)

Vishal Gupta
من قبل Vishal Gupta , SEO Head , KBCD INDIA

Case1 is used for better results in SEO

 

As <h1>  tag takes a defined designation for SEO, you should use anchor tag inside it so that Google Bot will be able to read Title of the page. 

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟