Is using a Href in Div OK?
-
Hi,
I was just wondering what your thoughts are on using a Href in a Div, which contains anchor text. We currently use the Href on the div, as opposed to just the anchor text as I want the whole div to be clickable as opposed to just the anchor text.
So currently I have:
Keword 1
Keyword 2Is this perfectly fine to do it like this as opposed to using <a tags="" ???<br="">I suppose there are various alternatives - if you must use the</a><a tag="" like:<="" p=""></a>
However I would assume a search engine is smart enought to know its the same thing???
Thanks
-
Many thanks - I'm going to have a serious word with my coders!!
-
As Dave shared, the W3C is the official organization for determining the validity of code. Generally speaking, you want your code to be valid.
If you want an area to be a click-able link try Maximise's suggestion.
-
Jesus - Thanks.
So your telling me that its totally invalud to:
1/. Wrap a href tag around a div tag.2/. Put a href tag as an atribute on a div tag.
If that is the case I'm going to have so serious words with my coders!!
-
Any time I have a question about valid HTML I go to the Source. W3C has an invaluable tool for HTML . Becoming familiar with this will help you always create clean code.
-
I would try and stay clear of doing this to be honest. It won't validate, older browsers may have problems with it and I'm not sure how search engines would treat it (they may not follow it). There are better ways to do it.
If you set your anchor tag to 'display:block' you can then set the height and width too. This way the whole div would be the link, not just the text.
-
Neither option is valid HTML. Browser behavior and crawler behavior would be unpredictable.
The code would be something like:
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Webmaster tools showing 200 page load ok - all other testing tools show a 301
hey, on https://www.xxx.co we've setup a 301 redirect to xxx.us - > BUT in webmaster tools its still showing a 200 load ok, whereas on all other testing tools its showing a 301 redirect (screamingfrog etc) even https://dns.google.com/query?name=www.xxx.co is showing that its 301 redirected. Any ideas? as we want to trigger the change of address tool in WMT and its saying it cant as it loads the homepage still....
Technical SEO | | RobertN-London0 -
Is it needed to use http:// or not?
Hi, When doing link building and getting my URL to other websites, is it necessary that the other websites include http:// before the domain? Example: I want to increase the number of links to my site www.example.com . When I ask other websites to add a link to my site, should I ask them to use http://www.example.com or is www.example.com enough (without http://)? Or it really does not matter? Thanks in advance, Sam
Technical SEO | | Awaraman0 -
Should I Use Two Domains for Multi Language Sites?
I have an immigration attorney that wants a website in English and another in Spanish. We're going to have some of the website content from the English site translated via a translator to make it true, conversation spanish (automatic translators are good, but not perfect, and we want perfect). So my question is do you think we should use two different domains (englishsite.com, spanishsite.com), a subdomain (spanishsite.englishsite.com) or maybe just a separate section of the regular site (englishsite.com/spanishcontent)? My thought would be either a subdomain or a separate section so that we're not splitting PR.
Technical SEO | | atstickel120 -
Am I using 301 correctly?
Hello, I have a 'Free download' type site for free graphics for designers. To prevent hot linking we authenticate the downloads and use a 301 redirect. So for example: The download URL looks like this if someone is clicking on the download button: http://www.website.com**/resources/243-name-of-the-file/download/dc37** and then we 301 that URL back to: http://www.website.com**/category-name/243-name-of-the-file** Is a 301 the correct way to do that?
Technical SEO | | shawn810 -
Google see 302 but it is 200 OK - OsCommerce
Hi! I´ve a problem with a webshop that run OsCOmmerce. Google report thousands of urls "Not followed" in Webmaster Tools, and it´s increasing for every day. When you fetch as Google you get a 302 to ../cookie_usage.php. But if you fetch the page in your browser you get 200 OK. Why does Google get 302 but users 200? We´ve checked for malware and restored old backups, nothing helps. Thoughts about this?
Technical SEO | | Vivamedia0 -
Problem? Use no follow with paid advertisers ? Or Duplicate site www.
I recently changed some content and added a few advertisers on my real estate site. then ... my traffic stopped! I thought it was possible duplicate indexpage.. can I just redirect index.html? I read the post about link dillution from today. The a site cape cod realtor.co since adding a few sponsors I noticed I lost some rank especiall for key word cape cod realtor. Im not showing in top 100 anymore with big "G" and I was #4. It also removed my G places rank I was #4 .. I shop 40 links in bing nothing in google that I can see from mozilla tool... thanks- J
Technical SEO | | Capecod0 -
Best way to use affiliate links
What is the best practice to use amazon affliate links in blog posts? I have read different opinions on this, and want to be sure I'm using best practices. I sometimes link to amazon with an affiliate link on some of my posts, and am working on a top ten Christmas gift ideas for Children born with Down syndrome with lots of affiliate links on it. I'm want to be sure I'm using best practices when adding links like this. Tanks!
Technical SEO | | NoahsDad0 -
What Google uses in search result descriptions
Recently, Google has started including certain information from our web pages in their search results description that is a bit puzzling. For example if you google 'Wedding Band Raleigh' the description they are using for our site's (GigMasters) page begins with the text 'Results 1 - 10 of 1005' Not sure why they are pulling that information. That is in on the page but its not high up on the page or marked with any special h1, h2, or h3 tag. We do have that information inside of a div which we have named 'Results'. Maybe that's why? Did we inadvertently use some sort of Google rich snippet or schema.org naming convention?! Any insight would be hugely appreciated.
Technical SEO | | gigmasters0