background:linear-gradient([position],color px......)  线性背景

还可以有一种写法:

background:-webkit-linear-gradient(to [position],color px)  不推荐这种写法

demo如下:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        .app{
            width: 300px;
            height: 300px;
            

        }
        /*linear-gradient([位置] , [开始点颜色   占用多少位置], [结束点颜色  过渡大小])*/
        .app{
            background: 
            -webkit-linear-gradient( 135deg,  transparent 100px, deeppink 0);
            background: 
            -moz-linear-gradient( 135deg, red 0 , white 0);
        }
    </style>
</head>
<body>
   <div class="app"></div>
</body>
</html>

 

 

(效果如上)ps:有时候使用透明(transparent)会有意想不到的效果

 

相关文章:

  • 2021-08-24
  • 2021-09-12
  • 2021-12-01
  • 2021-06-15
  • 2021-08-21
  • 2022-12-23
  • 2021-11-05
  • 2021-12-23
猜你喜欢
  • 2022-01-18
  • 2022-01-14
  • 2022-12-23
  • 2021-09-28
  • 2021-06-25
  • 2021-05-20
  • 2021-04-27
相关资源
相似解决方案