开发者

Button rendered differently in Firefox vs Webkit

I have a couple of buttons inside a div with a specific width, and I am facing a problem where the buttons are being rendered differently in firefox vs chrome and safari.

In firefox, the buttons are bigger and are messing up 开发者_Python百科my layout.

<div id="sort_by">
    <button id="sort_by_price" class="sortButton" value="1">Price</button>
    <button id="sort_by_bedrooms" class="sortButton" value="1">Bedrooms</button>
    <button id="compareButton" class="sortButton">Compare</button>
</div>

CSS:

button {
display:inline;
float:left;
background-color:orange;
border:1px solid orange;
border-radius:5px;
-moz-border-radius:5px;

font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
font-size:14px;
text-decoration:none;
font-weight:bold;
color:#FFFFFF;
cursor:pointer;
padding:4px 10px 3px 7px;

}

#sort_by {
width:265px;
height:35px;
border-bottom-style:solid;
border-bottom-width:2px;
border-color:#c9c9c9;
padding-top:3px;
padding-bottom:3px;
padding-left:5px;
}

Rendered in firefox:

Button rendered differently in Firefox vs Webkit

Rendered in Chrome:

Button rendered differently in Firefox vs Webkit

It can be seen that the buttons in firefox are bigger. How can I fix this? Thanks.


Firefox adds an extra margin/padding to button elements that cannot be changed by standard CSS, you can however add the following to make it behave

button::-moz-focus-inner { 
    border: 0;
    padding: 0;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜