CSS 角色带在 iPad 中未旋转(Chrome)
CSS corner ribbon not rotated in iPad (Chrome)
下面的 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>
我该如何解决?
您没有将 transform: rotate(-45deg);
的正确 -webkit-
供应商前缀表示为 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 范围内 class
关注此 link 以获取更多详细信息。
下面的 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>
我该如何解决?
您没有将 transform: rotate(-45deg);
的正确 -webkit-
供应商前缀表示为 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 范围内 class
关注此 link 以获取更多详细信息。