为 div 提供两种背景颜色 [英] Give two background colors to a div
本文介绍了为 div 提供两种背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的 div 后面有两个单独的背景 .login-section
示例 HTML:
<div class="login-section"></div>
我想给 .login-container
div 提供两种不同的背景颜色,如图所示
解决方案
您可以使用线性渐变背景.
.bg {高度:100vh;背景:线性梯度(#03a2e8 0%,#03a2e8 40%,#eeeeef 40%);}
<div class="bg"></div>
I would like to have two separate backgrounds behind my div .login-section
Sample HTML:
<div class="login-container">
<div class="login-section"></div>
</div>
I want to give two different background color to the .login-container
div as shown in the image
解决方案
You can use linear-gradient background.
.bg {
height: 100vh;
background: linear-gradient(#03a2e8 0%, #03a2e8 40%, #eeeeef 40%);
}
<div class="bg"></div>
这篇关于为 div 提供两种背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文