【问题标题】:CSS corner ribbon not rotated in iPad (Chrome)未在 iPad (Chrome) 中旋转的 CSS 角功能区
【发布时间】:2015-08-04 05:35:56
【问题描述】:

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

我该如何解决?

【问题讨论】:

    标签: html css ribbon css-shapes css-transforms


    【解决方案1】:

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-07-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多