1、效果图
2、查看效果
微信小程序搜索“知遇工具箱”,可查看具体效果和更多内容。
3、全部代码
html
<view class="textView">
<view class="text">
自适应背景颜色
</view>
</view>
css
.textView{
width: 100%;
height: 400rpx;
background: linear-gradient(35deg, #000000 50% , #ffffff 50%);
border: 1px solid red;
}
.text{
font-size: 60rpx;
text-align: center;
line-height: 400rpx;
//设置混合模式为 差值
mix-blend-mode: difference;
color: #ffffff;
letter-spacing: 8rpx;
}