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. Web Design
    4. Text-align: -900% in an absolute element?

    Text-align: -900% in an absolute element?

    Web Design
    14 3 1.6k
    • 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.
    • DanDeceuster
      DanDeceuster last edited by

      I've seen text-indent: -9999px in css all over the web. Perhaps this is the code you are looking for?

      1 Reply Last reply Reply Quote 0
      • Getz.pro
        Getz.pro last edited by

        I don't think you have this correct. What this does is to set text to a negative which sends it off the page, however, the div contains an image. So the image shows, but the text does not (to the user).

        This is often done with first letters of a paragraph to change to a unique font.

        but let us start with what are you trying to do 🙂

        ldestrooper 1 Reply Last reply Reply Quote 0
        • ldestrooper
          ldestrooper @Getz.pro last edited by

          Well yes, i use text text-align in a negative way so the text goes of the page, then i use a background-image to replace it. But it seems like text-indent is incompatible with an absolute position, so i'm looking for a better way to do the image replacement or a workaround for IE.

          Getz.pro ldestrooper 10 Replies Last reply Reply Quote 0
          • Getz.pro
            Getz.pro @ldestrooper last edited by

            why are you using absolute position on the image? if you want to move it around the div, use padding.

            1 Reply Last reply Reply Quote 0
            • ldestrooper
              ldestrooper @ldestrooper last edited by

              I'm not trying to. Using text-indent on the text and then using an image-background on the div is a common way of image replacement.

              1 Reply Last reply Reply Quote 0
              • Getz.pro
                Getz.pro @ldestrooper last edited by

                Yes, I understand that 🙂

                But why then are you using absolute positioning?

                Oh, and you are doing a text-indent at -9999px correct?

                .swap-image {

                text-indent: -9999px;

                background:url(path-to-image) top left no-repeat;

                min-height: 40px;

                }

                1 Reply Last reply Reply Quote 0
                • ldestrooper
                  ldestrooper @ldestrooper last edited by

                  That looks pretty much like i did it. It always works, just not for the absolute element. It is because it is a share box for facebook, twitter, etc. I've seen many options to make it go with the browser but obviously positioning it absolute is the best way.

                  It seems so hard to find a solution for this 😞

                  1 Reply Last reply Reply Quote 0
                  • Getz.pro
                    Getz.pro @ldestrooper last edited by

                    Let's start over. Why do you want an absolute position on this element? It should be positioned at the point where the text starts.

                    1 Reply Last reply Reply Quote 0
                    • ldestrooper
                      ldestrooper @ldestrooper last edited by

                      I'll give you the example, this is my test website:

                      http://www.computerworkstationdeskguide.com

                      I run my theme there to make sure i get everything right before publishing to my main one. If you go to a single post, you'll notice the sidebar on the left. That's where the problem lies. It shows nice verywhere, but in IE (and maybe not just in IE, i don't know) it still shows the text.

                      1 Reply Last reply Reply Quote 0
                      • Getz.pro
                        Getz.pro @ldestrooper last edited by

                        *** Again, sorry about the late response. I am moving, so please don't expect anything back until Thursday night ***

                        Please provide the CSS snippet for this. I see you are running a WP and have a few CSS files. I do not have time to search all of them to find the corresponding code.

                        I will look at this and get back to you.

                        1 Reply Last reply Reply Quote 0
                        • ldestrooper
                          ldestrooper @ldestrooper last edited by

                          No problem at all, thanks for the help! This is the exact same as i use:

                          • Text 1

                          • Text 2

                          #box {

                          width: 70px;

                          position: fixed;

                          }

                          #socialshare {

                          position: absolute;

                          }

                          #socialshare a {

                          display: block;

                          width: 50px;

                          height: 65px;

                          text-indent: -900%;

                          background: url('image.png') no-repeat;

                          }

                          1 Reply Last reply Reply Quote 0
                          • Getz.pro
                            Getz.pro @ldestrooper last edited by

                            You are not going to like this, but your code work in Safari and Firefox.

                            try using -900px instead of -900**%**

                            I also removed the position: fixed and position: absolute. What are you doing with these? I do not see where they are needed.

                            1 Reply Last reply Reply Quote 0
                            • ldestrooper
                              ldestrooper @ldestrooper last edited by

                              I use fixed and absolute so the box won't move when i scroll my browser.

                              I also tested in Safari and Firefox and works just fine, it's IE which is bugging me. 😞

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              • Text hidden in tabs on desktop
                                seoanalytics
                                seoanalytics
                                0
                                3
                                154

                              • Organization name as text vs. as a picture with alt text + Schema.org markup
                                BlueprintMarketing
                                BlueprintMarketing
                                1
                                6
                                587

                              • Body of text on category pages
                                EGOL
                                EGOL
                                0
                                3
                                159

                              • Google text-only vs rendered (index and ranking)
                                TomVolpe
                                TomVolpe
                                0
                                2
                                412

                              • Does google prefer expanded text to text that you have to mouse over to show?
                                InMarketingWeTrust
                                InMarketingWeTrust
                                0
                                3
                                185

                              • Duplicate H1 tag IF it holds SAME text?
                                RetroOnline
                                RetroOnline
                                0
                                8
                                2.4k

                              • Replaceing text prices with graphics
                                KaneJamison
                                KaneJamison
                                0
                                2
                                469

                              • Whats your Favorite font for text
                                Getz.pro
                                Getz.pro
                                0
                                5
                                1.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