undefined
Skip to content
Moz logo Menu open Menu close
  • Products
    • Moz Pro
    • Moz Pro Home
    • Moz Local
    • Moz Local Home
    • STAT
    • Moz API
    • Moz API Home
    • Compare SEO Products
    • Moz Data
  • Free SEO Tools
    • Domain Analysis
    • Keyword Explorer
    • Link Explorer
    • Competitive Research
    • MozBar
    • More Free SEO Tools
  • Learn SEO
    • Beginner's Guide to SEO
    • SEO Learning Center
    • Moz Academy
    • SEO Q&A
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • Case Studies
    • The Moz Story
    • New Releases
  • Log in
  • Log out
  • Products
    • Moz Pro

      Your all-in-one suite of SEO essentials.

    • Moz Local

      Raise your local SEO visibility with complete local SEO management.

    • STAT

      SERP tracking and analytics for enterprise SEO experts.

    • Moz API

      Power your SEO with our index of over 44 trillion links.

    • Compare SEO Products

      See which Moz SEO solution best meets your business needs.

    • Moz Data

      Power your SEO strategy & AI models with custom data solutions.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Free SEO Tools
    • Domain Analysis

      Get top competitive SEO metrics like DA, top pages and more.

    • Keyword Explorer

      Find traffic-driving keywords with our 1.25 billion+ keyword index.

    • Link Explorer

      Explore over 40 trillion links for powerful backlink data.

    • Competitive Research

      Uncover valuable insights on your organic search competitors.

    • MozBar

      See top SEO metrics for free as you browse the web.

    • More Free SEO Tools

      Explore all the free SEO tools Moz has to offer.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    Learn more
  • Learn SEO
    • Beginner's Guide to SEO

      The #1 most popular introduction to SEO, trusted by millions.

    • SEO Learning Center

      Broaden your knowledge with SEO resources for all skill levels.

    • On-Demand Webinars

      Learn modern SEO best practices from industry experts.

    • How-To Guides

      Step-by-step guides to search success from the authority on SEO.

    • Moz Academy

      Upskill and get certified with on-demand courses & certifications.

    • MozCon

      Save on Early Bird tickets and join us in London or New York City

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • Small Business Solutions

      Uncover insights to make smarter marketing decisions in less time.

    • Agency Solutions

      Earn & keep valuable clients with unparalleled data & insights.

    • Enterprise Solutions

      Gain a competitive edge in the ever-changing world of search.

    • The Moz Story

      Moz was the first & remains the most trusted SEO company.

    • Case Studies

      Explore how Moz drives ROI with a proven track record of success.

    • New Releases

      Get the scoop on the latest and greatest from Moz.

    Surface actionable competitive intel
    New Feature

    Surface actionable competitive intel

    Learn More
  • Log in
    • Moz Pro
    • Moz Local
    • Moz Local Dashboard
    • Moz API
    • Moz API Dashboard
    • Moz Academy
  • Avatar
    • Moz Home
    • Notifications
    • Account & Billing
    • Manage Users
    • Community Profile
    • My Q&A
    • My Videos
    • Log Out

The Moz Q&A Forum

  • Forum
  • Questions
  • Users
  • Ask the Community

Welcome to the Q&A Forum

Browse the forum for helpful insights and fresh discussions about all things SEO.

  1. Home
  2. SEO Tactics
  3. Technical SEO
  4. Is using a Href in Div OK?

Moz Q&A is closed.

After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

Is using a Href in Div OK?

Technical SEO
4
7
4.5k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • James77
    James77 last edited by Jul 18, 2011, 7:40 AM

    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 2

    Is 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>

    <a tag="" like:<="" p=""></a>

    Keword 1
    Keyword 2

    However I would assume a search engine is smart enought to know its the same thing???

    Thanks

    1 Reply Last reply Reply Quote 0
    • James77
      James77 @James77 last edited by Jul 18, 2011, 8:53 AM Jul 18, 2011, 8:53 AM

      Many thanks - I'm going to have a serious word with my coders!!

      1 Reply Last reply Reply Quote 1
      • RyanKent
        RyanKent @James77 last edited by Jul 18, 2011, 8:43 AM Jul 18, 2011, 8:42 AM

        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.

        1 Reply Last reply Reply Quote 1
        • James77
          James77 @RyanKent last edited by Jul 18, 2011, 8:31 AM Jul 18, 2011, 8:31 AM

          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!!

          RyanKent James77 2 Replies Last reply Jul 18, 2011, 8:53 AM Reply Quote 0
          • blackballonline
            blackballonline last edited by Jul 18, 2011, 8:53 AM Jul 18, 2011, 8:03 AM

            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.

            1 Reply Last reply Reply Quote 2
            • Maximise
              Maximise last edited by Jul 18, 2011, 8:53 AM Jul 18, 2011, 8:02 AM

              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.

              1 Reply Last reply Reply Quote 3
              • RyanKent
                RyanKent last edited by Jul 18, 2011, 8:32 AM Jul 18, 2011, 8:00 AM

                Neither option is valid HTML. Browser behavior and crawler behavior would be unpredictable.

                The code would be something like:

                Keword 1
                  

                James77 1 Reply Last reply Jul 18, 2011, 8:31 AM Reply Quote 1
                • 1 / 1
                1 out of 7
                • First post
                  1/7
                  Last post

                Got a burning SEO question?

                Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                Start my free trial


                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.

                • See all categories

                Related Questions

                • vikasnwu

                  Using 410 To Remove URLs Starting With Same Word

                  We had a spam injection a few months ago.  We successfully cleaned up the site and resubmitted to google.  I recently received a notification showing a spike in 404 errors. All of the URLS have a common word at the beginning injected via the spam: sitename.com/mono
                  sitename.com/mono.php?buy-good-essays
                  sitename.com/mono.php?professional-paper-writer There's about 100 total URLS with the same syntax with the word "mono" in them.  Based on my research, it seems that it would be best to serve a 410.  I wanted to know what the line of HTACCESS code would be to do that in bulk for any URL that has the word "mono" after the sitename.com/

                  Technical SEO | Nov 4, 2018, 10:46 PM | vikasnwu
                  0
                • Merkle-Impaqt

                  Can you use Screaming Frog to find all instances of relative or absolute linking?

                  My client wants to pull every instance of an absolute URL on their site so that they can update them for an upcoming migration to HTTPS (the majority of the site uses relative linking). Is there a way to use the extraction tool in Screaming Frog to crawl one page at a time and extract every occurrence of _href="http://" _? I have gone back and forth between using an x-path extractor as well as a regex and have had no luck with either. Ex. X-path: //*[starts-with(@href, “http://”)][1] Ex. Regex: href=\”//

                  Technical SEO | Oct 13, 2015, 6:31 PM | Merkle-Impaqt
                  0
                • Trevorneo

                  What punctuation can you use in meta tags? Are there any Google does not like?

                  So I know you can use dashes and | in meta tags, but can anyone tell me what other punctuation you can use? Also, it'd be great to know what punctuation you can't use. Thanks!

                  Technical SEO | Aug 24, 2015, 9:04 PM | Trevorneo
                  1
                • Alick300

                  301 redirect using javascript

                  Can I use javascript code to redirect(301) a webpage?

                  Technical SEO | Jun 11, 2016, 6:56 PM | Alick300
                  0
                • blakadz

                  Redirect non-www if using canonical url?

                  I have setup my website to use canonical urls on each page to point to the page i wish Google to refer to. At the moment, my non-www domain name is not redirected to www domain. Is this required if i have setup the canonical urls? This is the tag i have on my index.php page rel="canonical" href="http://www.mydomain.com.au" /> If i browse to http://mydomain.com.au should the link juice pass to http://www.armourbackups.com.au? Will this solve duplicate content problems? Thanks

                  Technical SEO | Feb 28, 2012, 2:53 AM | blakadz
                  0
                • upick-162391

                  Trailing Slashes In Url use Canonical Url or 301 Redirect?

                  I was thinking of using 301 redirects for trailing slahes to no trailing slashes for my urls. EG: www.url.com/page1/ 301 redirect to www.url.com/page1 Already got a redirect for non-www to www already. Just wondering in my case would it be best to continue using htacces for the trailing slash redirect or just go with Canonical URLs?

                  Technical SEO | Nov 27, 2011, 12:19 PM | upick-162391
                  0
                • FastLearner

                  Does google use the wayback machine to determine the age of a site?

                  I have a site that I had removed from the wayback machine because I didn't want old versions to show. However I noticed that in many seo tools the site now always shows a domain age of zero instead of 6 years ago when I registered it. My question is what do the actual search engines use to determine age when they factor it into the ranking algorithm? By having it removed from the wayback machine, does that make the search engines think the site is brand new? Thanks

                  Technical SEO | Sep 4, 2011, 4:38 AM | FastLearner
                  0
                • elephantseo

                  What tool do you use to check for URLs not indexed?

                  What is your favorite tool for getting a report of URLs that are not cached/indexed in Google & Bing for an entire site? Basically I want a list of URLs not cached in Google and a seperate list for Bing. Thanks, Mark

                  Technical SEO | Jun 23, 2024, 6:30 PM | elephantseo
                  3

                Get started with Moz Pro!

                Unlock the power of advanced SEO tools and data-driven insights.

                Start my free trial
                Products
                • Moz Pro
                • Moz Local
                • Moz API
                • Moz Data
                • STAT
                • Product Updates
                Moz Solutions
                • SMB Solutions
                • Agency Solutions
                • Enterprise Solutions
                Free SEO Tools
                • Domain Authority Checker
                • Link Explorer
                • Keyword Explorer
                • Competitive Research
                • Brand Authority Checker
                • Local Citation Checker
                • MozBar Extension
                • MozCast
                Resources
                • Blog
                • SEO Learning Center
                • Help Hub
                • Beginner's Guide to SEO
                • How-to Guides
                • Moz Academy
                • API Docs
                About Moz
                • About
                • Team
                • Careers
                • Contact
                Why Moz
                • Case Studies
                • Testimonials
                Get Involved
                • Become an Affiliate
                • MozCon
                • Webinars
                • Practical Marketer Series
                • MozPod
                Connect with us

                Contact the Help team

                Join our newsletter
                Moz logo
                © 2021 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                • Accessibility
                • Terms of Use
                • Privacy

                Looks like your connection to Moz was lost, please wait while we try to reconnect.