以下CSS3角落功能适用于Chrome桌面版,但如果您在iPad上打开它,则不会旋转。
http://jsfiddle.net/u6hqte8s/1/
.ribbon {
position: absolute;
left: -5px;
top: -5px;
z-index: 1;
overflow: hidden;
width: 70px;
height: 70px;
text-align: right;
}
.ribbon span {
font-size: 10px;
font-weight: bold;
background-color: #f1f1f1;
color: #000000;
text-transform: uppercase;
text-align: center;
line-height: 15px;
transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
width: 90px;
display: block;
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
-webkit-box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
-moz-box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 10px;
left: -15px;
}
.ribbon span::before {
content: "";
position: absolute;
left: 0px;
top: 100%;
z-index: -1;
border-left: 3px solid #bbbbbb;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-top: 3px solid #bbbbbb;
}
.ribbon span::after {
content: "";
position: absolute;
right: 0px;
top: 100%;
z-index: -1;
border-left: 3px solid transparent;
border-right: 3px solid #bbbbbb;
border-bottom: 3px solid transparent;
border-top: 3px solid #bbbbbb;
}
<div class="ribbon"><span>Test</span>
</div>
我该如何解决?
您没有为-webkit-
表示正确的transform: rotate(-45deg);
供应商前缀为required by safari / OSX etc
.ribbon span {
font-size: 10px;
font-weight: bold;
background-color: #f1f1f1;
color: #000000;
text-transform: uppercase;
text-align: center;
line-height: 15px;
transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg); /* <--- add this */
width: 90px;
display: block;
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
-webkit-box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
-moz-box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 10px; left: -15px;
}
使用-webkit-transform:rotate(-45deg);在.ribbon span类
点击此链接获取更多详细信息。