CSS角落色带未在iPad中旋转(Chrome)

问题描述 投票:1回答:2

以下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>

我该如何解决?

html5 css3 ribbon css-shapes css-transforms
2个回答
4
投票

您没有为-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;
}

0
投票

使用-webkit-transform:rotate(-45deg);在.ribbon span类

点击此链接获取更多详细信息。

https://developer.apple.com/library/archive/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Using2Dand3DTransforms/Using2Dand3DTransforms.html

© www.soinside.com 2019 - 2024. All rights reserved.