简体   繁体   中英

CSS problems across browsers, but IE working?

I am having problems placing a logo in my header. The header is in a span of 257px. It "appears" to place fine in Firefox/Chrome/Safari on both Mac and PC. With IE 8/9 it "appears" the problem exits. The twist here is that it actually works in IE and not the other browsers. I really need at least 21px for the padding-top.

With the CSS below, IE is actually correctly rendering it but all the other browsers are adding close to 20px in the padding-top.

The CSS as it stands now, after many different iterations is.

.img {
    display: block;
    padding: 1px 0 21px 8px;
    width: 200px;
    height: 40px;
}

Any help tracking this down would be appreciated.

how about using absolute positioning withing a relative positioned span/div?

say for example:

<div style="position:relative;">
  <img src="..." style="position: absolute; top: 21px">
</div>

this would place the image 21px from the top of the parent div.

to illustrate it better. i made a jsfiddle

http://jsfiddle.net/RD26R/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM