firefox adds strange space arround Pseudo-elements

后端 未结 3 1861
别跟我提以往
别跟我提以往 2021-01-24 06:25

Take a look at these photos
JSFiddle link at the bottom

firefox:
\"enter

3条回答
  •  粉色の甜心
    2021-01-24 07:10

    I'd recommend you to specify top:0; left: 0; to your ::before pseudo elements. Sometimes cheeky browsers take a few px up and left to the actual position. CSS:

    .like:before {
        float: none;
        width: 30px;
        content: "like";
        margin: 0px 10px 0px 0px;
        padding: 0px 5px;
        background-color: #FF7373;
        color: #FFF;
        border-right: 1px solid #CCC;
        position: absolute;
        top: 0;
        left: 0;
        border-radius: 4px 0 0 4px;
    }
    .like {
        float: none;
        height: 30px;
        border-radius: 4px;
        box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.5);
        padding: 0px 10px 0px 0px;
        margin: 12.5px 10px;
        background-color: #000;
        font: 16px/30px arial;
        color: #FFF;
        border: medium none;
        position: relative;
        width: 88px;
        text-align: right;
    }
    

    Fiddle: http://jsfiddle.net/79cEb/13/

提交回复
热议问题