开发者

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 measur开发者_StackOverflowes 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?


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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜