css 文字背景色只占一半高度

.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);
}

参考:https://blog.csdn.net/weixin_63743161/article/details/126169956

你可能感兴趣的:(css,前端)