我在Chrome中遇到一个问题,我用HTMLCSS创建了一个六边形组。它在Firefox中显示效果很好,但在镀铬中,六边形的边缘显示扭曲。我的代码如下

HTML

<div class="col-sm-12 margin-left-100" id="sortable">
    <div id="c_1" class="hexagon hexagon2 sort">
    <div class="hexagon-in1">
        <div class="hexagon-in2">
            <div class="inner inner-left text-center"><i class="fa fa-eye"></i></div><div class="inner inner-right text-center"><i class="fa fa-link"></i></div>
        </div>
    </div>
</div>
<div id="c_2"  class="hexagon hexagon2 sort">
    <div class="hexagon-in1">
        <div class="hexagon-in2">
            <div class="inner inner-left text-center"><i class="fa fa-eye"></i></div><div class="inner inner-right text-center"><i class="fa fa-link"></i></div>
        </div>
    </div>
</div>
</div>


CSS

.hexagon {
    overflow: hidden;
    visibility: hidden;
    -webkit-transform: rotate(120deg);
    -moz-transform: rotate(120deg);
    -ms-transform: rotate(120deg);
    -o-transform: rotate(120deg);
    transform: rotate(120deg);
    cursor: pointer;
    }
.hexagon-in1 {
    overflow: hidden;
    width: 100%;
    height: 100%;
    -webkit-transform: rotate(-60deg);
    -moz-transform: rotate(-60deg);
    -ms-transform: rotate(-60deg);
    -o-transform: rotate(-60deg);
    transform: rotate(-60deg);
    }
 .hexagon-in2 {
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: 50%;
    visibility: visible;
    -webkit-transform: rotate(-60deg);
    -moz-transform: rotate(-60deg);
    -ms-transform: rotate(-60deg);
    -o-transform: rotate(-60deg);
    transform: rotate(-60deg);
    }
.hexagon-in2{
    background: #6B6A6A;
    }

.hexagon1 {
    width: 200px;
    height: 100px;
    margin: 0 0 0 -80px;
    }
.hexagon2 {
   float: left;
   width: 80px;
   height: 117px;
   margin: -20px 0 0 20px;
  }
.inner{position: relative;color: #FFF; display: none; padding-top: 6px;   background: #009999;width: 50px;width: 34px;height: 32px;border-radius: 25px;}
div#sortable .hexagon:nth-child(5) {
    margin-left: 5px;
}
div#sortable .hexagon:nth-child(10) {
    margin-left: 50px;
}
div#sortable .hexagon:nth-child(14) {
    margin-left: 100px;
}


参见jsfiddle https://jsfiddle.net/vinie23/2jsqmgw2/

请帮我。您的帮助将不胜感激。提前致谢。

最佳答案

要消除Chrome中CSS转换上的那些锯齿状边缘,请添加CSS属性-webkit-backface-visibility: hidden;

小提琴:https://jsfiddle.net/2jsqmgw2/11/

关于javascript - 六边形的边缘 Chrome 不光滑,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31382972/

10-12 05:13