Forum Moderators: not2easy
I'm using layers (via div style) to position a pic. The problem is that the pic will like perfectly fine in IE, but in Safari, the pic is shifted 5 pixels to the right. I can't figure out if there's a way so that I can get the pic positioned perfectly in both browsers. Does anyone have a suggestion?
Here's an excerpt of what I have...
<style type="text/css">div.main{
position: absolute;
top: 20px;
left: 50%;
margin-left: -400px;
width: 800px;
height: 350px;
z-index: 100;}
</style><div id="main" class="main"><img src="http://www.example.com/image.jpg">
[edited by: DrDoc at 2:31 pm (utc) on Aug. 20, 2004]
[edit reason] Examplified URL. See TOS [WebmasterWorld.com] [/edit]
the pic is shifted 5 pixels to the right
Perhaps IE is applying a margin somewhere that is making it's halfway point offset a bit from Safaris. (I know NOTHING about Safari, but I do know IE occasionally adds different default margins from other browsers.)
Maybe you could try setting the image margin and padding to 0?
Or maybe one browser is displaying a vertical scrollbar and the other is not?
vertical-align only works on block elements
Actually, it's the opposite. CSS vertical-align applies to inline elements, defining where, in the vertical inline space, the element's content appears. It does NOT align element content in the vertical space of block elements as the deprecated v-align HTML attribute once did.
From the W3C:
This property affects the vertical positioning inside a line box of the boxes generated by an inline-level element.