css實現背景分割為多種顏色及一些特殊的背景設置


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    #box{
        background: linear-gradient(to right, red 0%,red 50%,white 51%,white 100%);
        border: 1px solid #ccc;
        width: 200px;
        height: 200px;
    }
    #box1{
        background: linear-gradient(45deg, red 0%,red 30%,transparent 30%,transparent 40%,blue 40%,blue 60%, white 61%,white 100%);
        border: 1px solid #ccc;
        width: 200px;
        height: 200px;
    }
    #box2{
        background-image:radial-gradient(at left top,red 30%,transparent 40%,blue 40%,transparent 50%, white 61%);
        border: 1px solid #ccc;
        width: 200px;
        height: 200px;
    }
</style>
<body>
    <div id="box"></div>
    <br>
    <div id="box1"></div>
    <br>
    <div id="box2"></div>

</body>
</html>

效果

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM