How to fill part of the background with gradient color?
I'd like to have div
with color filled background:
filling only 20% from the bottom of the div
.
.my-div { background-image: linear-gradient(to right, transparent, #FFEBEE); }
How to define second condition?
https://jsfiddle.net/tf4nn5p6/
这是你想要的吗?
.my-div{
text-align: center;
height: 50px;
background-image: linear-gradient(to right, transparent, #FFEBEE);
background-size: 100% 20%;
background-position: left bottom;
background-repeat: no-repeat;
border: 1px solid red;
}
<div class='my-div'>
text
</div>
Use below css for the same and here you can control by background-size: 100% 20%; and background-position: left bottom; with no-repeat
.my-div{
height: 50px;
background: linear-gradient(to right, transparent, #FFEBEE);
background-size: 100% 20%;
background-position: left bottom;
background-repeat: no-repeat;
border: 1px solid red;
text-align: center;
}
链接地址: http://www.djcxy.com/p/89338.html
上一篇: 背景的渐变
下一篇: 如何用渐变色填充部分背景?