htmlcssimage-replacement

Image replacement and text-align: right


I'm trying to do implement image resizing techniques, and they all work very well -- that is, until you pop in a:

body {
    text-align: right;
}

Example: http://jsfiddle.net/mAGhh/

Has anyone dealt with this before? I could certainly wrap all the elements and use image replacement then, but I'm pretty sure I will run into inline issues ....


Solution

  • If you use this to remove the text for image replacement:

    element {
        text-indent: -9999px;
    }
    

    ...and you have text-align:right, the negative indentation won't work right. The trick is designed to work with standard left-aligned text.

    A good defensive measure is to explicitly declare text-align:left on the element when you do image replacement this way.