开发者

css difference between firefox/Mac & firefox/Windows

开发者 https://www.devze.com 2023-01-21 21:50 出处:网络
I\'m working on a template with a designer and we see different things. In my browser on mac the input field are next to the labels but for the designer in his browser the input fields are under the l

I'm working on a template with a designer and we see different things. In my browser on mac the input field are next to the labels but for the designer in his browser the input fields are under the labels.

I use eric meyer's css reset so everything should be correct. H开发者_运维技巧ere's a screenshot to illustrate what I mean (left is what it should be and on the right what it shouldn't be)

css difference between firefox/Mac & firefox/Windows

Does anyone know how this could be fixed?


If field sizes are given in ems, then change them to px.

em is dependent on font-size, and font sizes aren't pixel-perfect (different browsers round it differently, exact width may depend on font, especially if that gap between fields is a space).

Leave some room in the container (just make containing element few pixels wider than it has to be).

You may also try:

input {
 box-sizing: border-box; 
 -moz-box-sizing: border-box; -webkit-box-sizing: border-box;
}   

Which makes sizes of form elements a little bit more consistent.


I know this question is asked a long time ago but I was having a similar problem today and thought I share the solution that worked for me.

Put a font-size and width on the input field, this might help as it seems the default values for font-size is (or can be) different in windows and mac. In this way you can continue to use ems, which I personally prefer to use.


You could try something like $_SERVER['HTTP_USER_AGENT'] if you are using php or check how to get the user agent in your chosen server side programming language. Based on the user agent, you can then stick the condition in the head section of the html document to print the css. Make sure it is the last in the order so that you can override your previously written css. This is just one option. This is useful if you have complex design.

0

精彩评论

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

关注公众号