實現思路:
網格背景,由css3的線性漸變來實現。
紙上的打孔,由圓和圓柱組成,多個打孔,可以由box-shadow的平鋪來實現。
實際代碼:
<!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實現信紙/同學錄效果(代碼示例)的詳細內容,更多請關注億速云其它相關文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。