线性渐变如:(百分比是位置)
background: linear-gradient(to right, rgba(0,0,0,.1) 0%, rgba(0,0,0,.8) 50%, rgba(0,0,0,.1) 100%);
示例:
页面背景色#F6F6F6,文字颜色#FFFFFF,用到线性渐变包括 左->中<-右 及 上->下 的颜色加深
<div class="title"><p><span>出品人</span></p></div>
.title{
width: 100%;
text-align: center;
}
p{
width: 238px;
height: 47px;
margin: 0 auto;
/* 写的时候用的 下->上 颜色变浅所以是 to top */
background: linear-gradient(to top, rgba(43,99,170,.25) 0%,rgba(43,99,170,.05) 20%,rgba(43,99,170,.05) 30%,rgba(43,99,170,.02) 50%,rgba(62,144,204,.1) 95%, rgba(62,144,204,.1) 100%);
}
span{
display: inline-block;
width: 238px;
height: 47px;
line-height: 47px;
font-size: 36px;
font-family: PingFang SC Heavy;
font-weight: 800;
color: #FFFFFF;
/* 0%和100%即最左最右颜色最浅 */
background: linear-gradient(to right, rgba(250,250,250,1) 0%,rgba(62,144,204,.05) 12%,rgba(62,144,204,.35) 25%, rgba(62,144,204,.75) 36%,rgba(62,144,204,1) 50%,rgba(62,144,204,.75) 64%,rgba(62,144,204,.35) 75%,rgba(62,144,204,.05) 88%, rgba(250,250,250,1) 100%);
}
css效果: