这是我只使用css的照片,但是图像不是中心的,而且图像变大了,而不是掩码。
我想在这里达到同样的效果
http://jackietrananh.com/portfolio.php
他使用的是图像http://jackietrananh.com/img/sprite-s82d3b02845.png,但是如何使用纯css或js呢?
而没有
clip-path发布于 2015-05-07 14:39:19
我将完成如下工作: HTML:
<div class="round">
<img src="http://www.somebodymarketing.com/wp-content/uploads/2013/05/Stock-Dock-House.jpg"/>
</div>CSS:
.round{
width:10%;
padding-top:10%;
overflow:hidden;
position:relative;
border-radius:50%;
}
img{
position:absolute;
top:50%;
left:50%;
min-width:100%;
height:100%;
transform:translate(-50%,-50%);
transition: 1s ease;
}
img:hover{
height:110%;
}示例:CodePen
发布于 2015-05-07 13:51:11
.avatar-frame{border: 2px solid #c7b89e;}
.avatar-frame,.avatar-frame img{
width: 50px;
height: 50px;
-webkit-border-radius: 30px; /* Saf3+, Chrome */
border-radius: 30px; /* Opera 10.5, IE 9 */
/*-moz-border-radius: 30px; Disabled for FF1+ */
}发布于 2015-05-07 13:50:46
使用css,您可以将其设置为background并将其定位到中心:
background: url("http://media.trb.com/media/photo/2011-11/241153480-30235112.jpg") no-repeat center center;下面是一个演示:http://jsfiddle.net/shbnts90/3/
https://stackoverflow.com/questions/30103019
复制相似问题