本文主要包含CSS,linear,边框等相关知识,佚名 希望在学习及工作中可以帮助到您
网上看到一种利用linear-gradient属性制作绚丽边框效果的方法。首先给出代码,大家可以在自己的电脑中查看效果:
- <!DOCTYPE html>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta charset="utf-8" />
- <title></title>
- <style>
- .box {
- margin: 80px 30px;
- width: 200px;
- height: 200px;
- position: relative;
- background: #fff;
- float: left;
- }
- .box:before {
- content: '';
- z-index: -1;
- position: absolute;
- width: 220px;
- height: 220px;
- top: -10px;
- left: -10px;
- }
- .first:before {
- background-image: linear-gradient(90deg, yellow, gold);
- }
- .second:before {
- background-image: linear-gradient(0deg, orange, red);
- }
- .third:before {
- background-image: repeating-linear-gradient(-45deg,#cc2a2d,#cc2a2d 30px,#f2f2f2 30px,#f2f2f2 40px,#0e71bb 40px,#0e71bb 70px,#f2f2f2 70px,#f2f2f2 80px);
- }
- </style>
- </head>
- <body>
- <div class="box first"></div>
- <div class="box second"></div>
- <div class="box third"