使用 linear-gradient 线性渐变,做出头部区域:
布局:
<body>
<div class="head">
</div>
</body>
样式部分:
<style>
*{
padding: 0;
margin: 0;
}
.head{
width: 100%;
height: 100px;
background-color: black;
position: relative;
}
.head::after{
content: '';
display: block;
width: 100%;
height: 10px;
position: absolute;
top: 0;
left: 0;
background: black linear-gradient(to left,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55);
}
</style>
就是这么简单: