您的位置:首页 > 其它

clip:rect()

2016-06-16 12:55 591 查看
写进度条的时候用过这个方法,记录一下

它的用法是

.test{
clip: rect(<top>, <right>, <bottom>, <>left);
}


方向是按顺时针走的。

具体这四个值代表什么意思,看下面这几张图就明白了。





Demo

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>Clip</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.wrapper{
width: 100%;
position: relative;
}
.woodman {
position: absolute;
top: 0;
right: 0;
clip: rect(52px, 280px, 290px, 95px);
}
</style>
</head>
<body>
<div class="wrapper">
<img src="woodman.jpg"/>
<img src="woodman.jpg" class="woodman"/>
</div>
</body>
</html>


结果如下



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: