纯css3实现信纸/同学录效果(代码示例)


本文摘自PHP中文网,作者青灯夜游,侵删。

实现思路:

网格背景,由css3的线性渐变来实现。

纸上的打孔,由圆和圆柱组成,多个打孔,可以由box-shadow的平铺来实现。

实际代码:

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

46

47

48

49

50

51

52

53

54

55

56

57

58

<!DOCTYPE html>

<html>

<head>

  <meta charset="UTF-8">

  <title>Title</title>

<style>

.bg-grid {

    height: 400px;

    padding: 10px;

    padding-top: 64px;

    background-color: #efefef;

    background-image:   linear-gradient(#e7e6e6 1px, transparent 0),

                        linear-gradient(90deg, #e7e6e6 1px, transparent 0);

    background-size: 21px 21px, 21px 21px;

    background-position: center;

}

 

.bg-grid:before,

.bg-grid:after{

    content: '';

    position: absolute;

    z-index: 0;

    left: 50%;

    transform: translateX(-50%);

    display: inline-block;

    background-color: #fff;

    height: 28px;

    box-shadow: 68px 0 0 0 #fff,

                calc(68px * 2) 0 0 0 #fff,

                calc(68px * 3) 0 0 0 #fff,

                calc(68px * 4) 0 0 0 #fff,

                calc(68px * 5) 0 0 0 #fff,

                -68px 0 0 0 #fff,

                calc(68px * -2) 0 0 0 #fff,

                calc(68px * -3) 0 0 0 #fff,

                calc(68px * -4) 0 0 0 #fff,

                calc(68px * -5) 0 0 0 #fff;

}

.bg-grid:before {

    top: 0;

    width: 10px;

}

 

.bg-grid:after {

    top: 26px;

    width: 28px;

    border-radius: 50%;

}

.bg-grid{

 

}

</style>

</head>

<body>

<div></div>

 

</body>

</html>

更多炫酷CSS3、html5、javascript特效代码,尽在:js特效大全

更多相关教程请访问 CSS3最新版参考手册

以上就是纯css3实现信纸/同学录效果(代码示例)的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

border-radius属性如何使用

CSS3如何设置placeholder的样式

box-sizing属性怎么用

CSS3 appearance属性怎么用?

CSS3实现3d翻转效果的代码示例

animation-fill-mode属性怎么用

CSS3动画如何停止

CSS3绘制一个圆圆的loading转圈动画实例分享

ie7兼容CSS3吗?

css <basic-shape>的基本形状函数有哪些?如何使用?

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




打赏

取消

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

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

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

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

评论

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