开发者

display:table adds padding/margin in webkit browsers but not FF or IE

开发者 https://www.devze.com 2023-04-09 08:17 出处:网络
I\'m working on some boxes where I\'m forced to using the following css on a div in order to make it look right:

I'm working on some boxes where I'm forced to using the following css on a div in order to make it look right:

display:table;

It works fine in Firefox + Internet Explorer, but I just noticed that it adds a 1px border/margin/padding in webkit browsers (Safari / Ch开发者_开发技巧rome), which moves the box a bit... How can I get rid of this?

I've uploaded a picture example of how it's rendered:

http://imageshack.us/photo/my-images/854/examplez.jpg/

Is there a "simple way" of determining in the stylesheet whether you are using a webkit browser or not? Because then I could just add a "margin-left:-1px".. I know there is a way of determining the browsertype in jQuery, but I think it's kind of overkill for this..

0

精彩评论

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