简体   繁体   English

Firefox和Chrome中HTML的不同表示

[英]different represent of HTML in firefox and chrome

I am confused with: this code daemon display different in Firefox and Chrome: 我感到困惑:此代码守护程序在Firefox和Chrome中显示不同:

<div style="border:1px solid black;"> 
    <a href="baidu.com" >AA<span style="float:right">BB</span></a>
</div>
a {
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: normal;
    line-height: 1.42857;
    color: rgb(51, 51, 51);
    white-space: nowrap;
    border:1px solid red;
}

CodePen: http://codepen.io/ChinaXing/pen/jwFon CodePen: http ://codepen.io/ChinaXing/pen/jwFon

In Chrome: 在Chrome中:

在Chrome中

In Firefox: 在Firefox中:

在Firefox中

Remove the style 'white-space: nowrap' 删除样式“空白:nowrap”

AABB AABB

 a {
    padding: 3px 20px;
    font-weight: normal;
    clear: both;
    line-height: 1.42857;
    color: rgb(51, 51, 51);
    border:1px solid red;
}
span {
    float:right;
}

Add text-align:left; overflow:hidden; 添加text-align:left; overflow:hidden; text-align:left; overflow:hidden; to the anchor tag 到锚标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM