css如何剪切元素??clip属性的使用


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

.container {

  margin: 40px auto;

  width: 300px;

  position: relative;

}

 

.element {

  width: 300px;

  height: 300px;

  z-index: 0;

  position: absolute;

  -webkit-transition: clip .4s ease-in-out, z-index .2s linear .4s;

  transition: clip .4s ease-in-out, z-index .2s linear .4s;

}

 

img {

  max-width: 100%;

}

 

.element-1 {

  background-color: #2c3e50;

  clip: rect(0px, 150px, 150px, 0px);

}

 

.element-2 {

  background-color: #f39c12;

  clip: rect(0px, 300px, 150px, 150px);

}

 

.element-3 {

  background-color: #16a085;

  clip: rect(150px, 150px, 300px, 0px);

}

 

.element-4 {

  background-color: #8e44ad;

  clip: rect(150px, 300px, 300px, 150px);

}

 

.element:hover {

  z-index: 1;

  -webkit-transition: clip .4s ease-in-out .2s, z-index .2s linear;

  transition: clip .4s ease-in-out .2s, z-index .2s linear;

  clip: rect(0px, 300px, 300px, 0px);

}

效果图:

GIF.gif

浏览器支持度

所有主流浏览器都支持clip属性:Chrome,Firefox,Safari,Opera,Internet Explorer以及Android和iOS。

Internet Explorer版本7回到4支持旧的空格分隔rect()语法。从IE8开始支持标准的逗号分隔语法。

总结:以上就是本篇文章的全部内容,希望能对大家的学习有所帮助。

以上就是css如何剪切元素??clip属性的使用的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

css中zoom属性有什么作用

css不显示图标怎么办

css字间距怎么设置

css怎么实现禁止拖动

css怎么设置下边框

css如何使用important

css div怎么不换行显示

html如何给段落加粗

css怎么修改滚动条的样式

什么是css样式层叠表

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...