StackOverflowNewbie
StackOverflowNewbie

Reputation: 40633

Text Not Aligning Properly - font-size issue?

I'm trying to align text on top of an image in such a way that it remains aligned even if the underlying image is increased/decreased in size. I'm using px values that were taken from Photoshop measurements.

Please take a look at http://jsfiddle.net/dXNgx/. The word "For" is being overlaid on the image. It measures 20px in height, but when placed on the image, font-size: 20px; results in a "For" that is smaller than the underlying image. What gives?

Upvotes: 0

Views: 137

Answers (1)

sunn0
sunn0

Reputation: 3046

You need to place the div.layer outside of the #page1 as otherwise -moz-transform:scale(.5); is applied to it.

<a href="#" id="zoom_in">Zoom In +</a> | <a href="#" id="zoom_out">Zoom Out -</a>
<div style="position:relative;">
    <div style="-moz-transform:scale(.5); -moz-transform-origin:left top;position:absolute;" class="page" id="page1">
        <div class="layer" style="z-index:1;">
            <img src="http://cobalt.xtracta.com/images/image.jpg" style="width:2480px; height:3508px">
        </div>
    </div>
    <div class="layer" style="z-index:2;">
        <div style="font-size: 20px; position:absolute; color:#F00; top: 1550px; left: 306px;">For</div>
    </div>
</div>

http://jsfiddle.net/dXNgx/2/

Upvotes: 2

Related Questions