Reputation: 2058
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/
Upvotes: 0
Views: 2558
Reputation: 1316
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;
}
Upvotes: 0
Reputation: 3431
Is this what you want?
.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>
Upvotes: 5