在Safari中显示标题

时间:2017-03-21 18:06:40

标签: css safari transitions

我正在创建一个应该从图像旋转以显示标题的网站,但由于某种原因它会旋转,但它并没有显示野生动物园中的标题。该网站是[lomsasd.com/Graphic.html] [1]

css代码是:



.designers-item figure img {
    display:inline;
    position:relative;
    z-index:10;
 
}
.designers-item figure figcaption {
    display:inline;
    position:absolute;
    z-index:5;
    -webkit-box-sizing:border-box;
    -moz-box-sizing:border-box;
    box-sizing:border-box
}
.designers-item figure h2 {
    font-family: 'Open Sans', sans-serif;
    color:#fff;
    font-size:20px;
    text-align:left;
    margin-top: -4px;
    padding-top: 0;
    
}
.designers-item figure p {
   font-family: 'Open Sans', sans-serif;
    margin-top: -10px;
    display: inline-block;
    font-size:14px;
    line-height:18px;
    color:#fff;
    text-align:left
}
.designers-item figure figcaption {
    top:0;
    left:0;
    width:100%;
    height:100%;
    padding: 10px 10px;
    background-color: #995E80;
    backface-visibility:hidden;
    -webkit-transform:rotateY(-180deg);
    -moz-transform:rotateY(-180deg);
    transform:rotateY(-180deg);
    -webkit-transition:all .5s;
    -moz-transition:all .5s;
    transition:all .5s;
    text-align: center;
}
.designers-item figure img {
    backface-visibility:hidden;
    -webkit-transition:all .5s;
    -moz-transition:all .5s;
    transition:all .5s
}
.designers-item figure:hover img,figure.hover img {
    -webkit-transform:rotateY(180deg);
    -moz-transform:rotateY(180deg);
    transform:rotateY(180deg)
}
.designers-item figure:hover figcaption,figure.hover figcaption {
    -webkit-transform:rotateY(0);
    -moz-transform:rotateY(0);
    transform:rotateY(0)
}




由于

1 个答案:

答案 0 :(得分:0)

看看这是否能解决您的问题。 警告:我使用了与您不同的CSS类名称。

HTML:

<div class="container">
    <div class="item">
        <figure>
            <img src="http://www.eldes.com.br/wp-content/uploads/2017/01/chalkboard-burger-detail-1.jpg" />
            <figcaption>Figura 1</figcaption>
        </figure>
    </div>
    <div class="item">
        <figure>
            <img src="http://www.eldes.com.br/wp-content/uploads/2017/01/chalkboard-burger-detail-1.jpg" />
            <figcaption>Figura 2</figcaption>
        </figure>
    </div>
    <div class="item">
        <figure>
            <img src="http://www.eldes.com.br/wp-content/uploads/2017/01/chalkboard-burger-detail-1.jpg" />
            <figcaption>Figura 3</figcaption>
        </figure>
    </div>
</div>

CSS:

.container {
    display:  flex;
    flex-flow:  row wrap;
}

.item {
    display: block;
    flex:  0 0 200px;
    margin-left:  20px;
    border:  1px solid #000;
    width:  200px;
    height:  200px;
}

.item figure {
    display: flex;
    flex-flow: column nowrap;
    margin:  0px;
    padding:  0px;
}

.item figure img {
    position: absolute;
    z-index: 2;
    display: block;
    flex: 0 0 200px;
    width:  200px;
    height:  200px;
    -webkit-transform:  rotateY(0deg);
    transform:  rotateY(0deg);
    transition:  transform 1s, z-index 1s;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.item figure figcaption {
    position: absolute;
    z-index: 1;
    display: block;
    flex: 0 0 200px;
    width:  200px;
    height: 200px;
    background-color: #FF0;
    -webkit-transform:  rotateY(180deg);
    transform:  rotateY(180deg);
    -webkit-transition:  transform 1s, z-index 1s;
    transition:  transform 1s, z-index 1s;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.item:hover figure img {
    z-index: 1;
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
}

.item:hover figure figcaption {
    z-index:  2;
    -webkit-transform: rotateY(360deg);
    transform: rotateY(360deg);
}

关键点是属性转换转换 z-index 。 我希望这会对你有所帮助。