The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

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

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. For an image which is in the CSS and not the HTML, can you add an alt tag?

    For an image which is in the CSS and not the HTML, can you add an alt tag?

    Technical SEO Issues
    3 3 1.5k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BridgetGibbons
      BridgetGibbons last edited by

      I would like to improve SEO on a page with three big images, which are currently hosted in the CSS. The sample I am working with is at http://xquisitevents.com/about-us/

      and I put my cursor over the big picture of the wedding dress with bouquet, I inspected the element and saw this code in a div tag:

      #upperleft {

      1. background-image:url(images/AboutTopLeft.jpg);

      Can I add an alt tag to the CSS somehow, or can I have it added to the HTML? What is the best way to handle this, to include keywords like

      exquisite weddings and special event designs?

      1 Reply Last reply Reply Quote 0
      • LynnPatchett
        LynnPatchett last edited by

        Hi Bridget,

        There is no alt attribute in css, so no you cannot add it there,

        There are a couple of things you can do.

        1. Optimizing your image file names will at least give an indication of what the image is about and

        2. Rethink your css and the use of background images. Specifically you could get the same effect as you have now without background images using a combination of absolutely and relatively positioned divs. This way you can have the same layout as now but with the image in the html rather than the css and alt tags will be available for them.

        Check the link here for some demo code: http://stackoverflow.com/questions/8708945/how-to-position-text-over-an-image-in-css

        Hope that helps!

        SEOAndy 1 Reply Last reply Reply Quote 2
        • SEOAndy
          SEOAndy @LynnPatchett last edited by

          further to this you could look at having the image above some text and the text describes the image -- using z-index to layer them - hope that makes a little sense... if not google z-index 🙂

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • Alt Tags on HTML5 Videos
            0
            1
            31

          • Image Size in Alt Text
            AliMac26
            AliMac26
            0
            5
            503

          • I am trying to generate GEO meta tag for my website where on one page there are multiple locations My question is, Can I add GEO tagging for every address?
            0
            1
            96

          • Why add .html to WordPress pages?
            SergioB1717
            SergioB1717
            2
            7
            1.1k

          • Alt Tags - how important for SEO?
            BeckyKey
            BeckyKey
            0
            5
            1.3k

          • Can ALT tags for a Gallery be identical for all images with just the no changes?
            Toddfoster
            Toddfoster
            1
            2
            134

          • Tags - what keywords should i add ?
            IM_Learner
            IM_Learner
            0
            5
            370

          • Image optimisation, alt and title tags
            malachiii
            malachiii
            0
            4
            2.3k

          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
          • Digital Marketers
          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 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
          • Accessibility
          • Terms of Use
          • Privacy