difference between Firefox and Chrome padding

后端 未结 6 488
野趣味
野趣味 2021-02-05 04:56

there is a difference in how firefox and chrome render the padding in css. what appears correct in chrome is extra padded in firefox. is there a way to solve?

.b         


        
相关标签:
6条回答
  • 2021-02-05 05:21

    Firefox and Chrome render padding exactly the same way. Your problem is elsewhere.

    Are you using a reset CSS? If not, the default line-height declaration might be interfering with the rendering of your button.

    For one, your height is way smaller than your font-size. Since you don't have overflow specified, your height will always be extended to at least font-size (or whatever your line-height specifies).

    If your .button class is actually a <button> element, also apply superUntitled fix.

    0 讨论(0)
  • 2021-02-05 05:23

    u can set a different padding for firefox

    .button {
       padding:0;
    }
    
    @-moz-document url-prefix() {
        .button {
           padding:10px;
        }
    }
    
    0 讨论(0)
  • 2021-02-05 05:24

    If your .button is a button this might be a mozilla inner focus thing... try this?

    .button::-moz-focus-inner { border: 0; padding: 0; margin:0; }
    
    0 讨论(0)
  • 2021-02-05 05:24

    The focus-inner fix works but I also add negative top and bottom margins to get it to the right height. e.g.:

    *::-moz-focus-inner {
    padding: 0;
    border: 0;
    margin-top:-1px;
    margin-bottom:-1px;
    }
    

    I used to love Firefox, but it has become a bloated mess and fell off my Christmas list years ago.

    0 讨论(0)
  • 2021-02-05 05:24

    The way that worked for me was to set the height of the object so that firefox, chrome and opera render it the same way, and remove all padding.

    .footertext6{
        float: left;
        padding-top:10px;
        width: 160px;
        height:102px; */setting height here*/
        background-color:#ffffff;
        opacity:0.6;
        filter:alpha(opacity=60); /* For IE8 and earlier */
        font-family: "Trebuchet MS", Helvetica, sans-serif;
        font-size: 15px;
        border-top-right-radius: 50px;    
    }
    
    0 讨论(0)
  • 2021-02-05 05:39

    You are actually correct - there is a bug in Firefox where the button element's line height cannot be changed with the CSS line-height property.

    See this link for details: http://www.cssnewbie.com/input-button-line-height-bug/

    The solution is to use padding instead of line-height.

    0 讨论(0)
提交回复
热议问题