span{ display: block; background: #f4f4f4; color: #333; font-size: 14px; -webkit-border-radius: 20px; border-radius: 20px; text-align: center; height: 32px; line-height: 32px; margin-right: 10px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 4em; } .span1{ /* 在 M7007 下背景色會超出圓角 border: 1px solid #ededed; */ border: 1px solid #ededed; } .span2{ border: none; box-shadow: 0 0 0 1px #ededed; }
<br> <span class="span1">一些文案</span> <br> <span class="span2">一些文案</span>
在M7007手機上顯示效果:
可以第一個span的背景色超出了border-radius定義范圍
可能的解釋:
border-radius定義了border的圓角,未定義span的圓角范圍
修改為:
不設置border,則border-radius對整個span生效。再加box-shadow實現border效果