.Sectitle {
display: inline-block;
position: relative;
}
.Sectitle::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 40%;
background-color: rgba(124, 144, 235, 0.2);
}
效果:
转载借鉴: 标题背景色只给一半高度