[英]CSS code to show tags in a rounded box breaks once uploaded to server
我有CSS代码来显示标签,并且在我的localhost
(Node.Js应用程序)上一切正常,但是一旦将其上传到服务器上,就会出现奇怪的行,并且两个版本都使用相同的git仓库。
您知道可能是什么问题吗?
这是HTML代码
<ul class="tags">
<li><a href="#">tag 1</a></li>
<li><a href="#">tag 2</a></li>
<div class="tagsend"></div>
</ul>
和CSS
.tags{
margin:0;
padding:0;
list-style:none;
}
.tags li, .tags a{
float:right;
height:24px;
line-height:24px;
position:relative;
font-size:11px;
}
.tagsend {
clear:both;
}
.tags a{
margin-left:20px;
padding:0 10px 0 12px;
background:#0089e0;
color:#fff;
text-decoration:none;
-moz-border-radius-bottomright:4px;
-webkit-border-bottom-right-radius:4px;
border-bottom-right-radius:4px;
-moz-border-radius-topright:4px;
-webkit-border-top-right-radius:4px;
border-top-right-radius:4px;
}
.tags a:before{
content:"";
float:left;
position:absolute;
top:0;
left:-12px;
width:0;
height:0;
border-color:transparent #0089e0 transparent transparent;
border-style:solid;
border-width:12px 12px 12px 0;
}
.tags a:after{
content:"";
position:absolute;
top:10px;
left:0;
float:left;
width:4px;
height:4px;
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:2px;
background:#fff;
-moz-box-shadow:-1px -1px 2px #004977;
-webkit-box-shadow:-1px -1px 2px #004977;
box-shadow:-1px -1px 2px #004977;
}
.tags a.notfound{
background: #666666;
opacity: 0.2;
}
.tags a.notfound:before{
border-color:transparent #666666 transparent transparent;
}
.tags a:hover{
background:#666;
opacity: 0.2;
}
.tags a:hover:before{
border-color:transparent #555 transparent transparent;
}
视觉伪像很可能与将Chrome缩小到100%以外的水平有关(感谢@ArberBraja提供了提示,并实际找到了它)。 在Chrome中默认使用100%缩放比例时,我完全没有遇到这个问题,但是当我缩小到90%时,我会遇到这个问题:
如果这仍然是一个问题(例如:您需要在所有缩放级别上都支持“像素完美”渲染),则需要对添加标签的倾斜尖端的方式进行重新设计,使其变得不太聪明:
.tags a:before{
content:"";
float:left;
position:absolute;
top:0;
left:-12px; // This is the problem
width:0;
height:0;
border-color:transparent #0089e0 transparent transparent;
border-style:solid;
border-width:12px 12px 12px 0;
}
由于您将边框向左偏移了12个像素,因此Chrome会将这个数字缩小为可以产生小于像素完美效果的值。 您可能需要为整个标签使用纯色背景图像,以便正确支持所有缩放级别。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.