Reputation: 183
I'm trying to get a div to stick to the bottom of another div using position: absolute
and bottom:0; right:0
, but it isn't working because there's still a small space left between the div and the bottom.
#weekly-product-container {
margin-top: 91px;
background: black;
padding-top: 20px !important;
width: 100vw;
min-height: 500px;
text-align: center;
border-left: 1px solid #eee;
display: flex;
flex-direction: row;
background-color: black;
color: white;
margin-top: 100px;
}
#triangle5 {
width: 0px;
height: 0px;
border-left: 300px solid transparent;
border-bottom: 200px solid red;
border-bottom-right-radius: none;
bottom: 0;
position: absolute;
right: 0;
}
<div id="weekly-product-container">
<div id="triangle5"></div>
</div>
Upvotes: 0
Views: 78
Reputation: 1242
All you have to do, is add position: relative; to weekly-product-container and change bottom: 0; for triangle5:
#weekly-product-container {
position: relative;
}
#triangle5 {
position: absolute;
bottom: 0;
}
Here is an example: https://jsfiddle.net/cr29y1tc/30/
Upvotes: 1
Reputation: 5880
Set position: relative;
on container:
#weekly-product-container {
margin-top: 91px;
background: black;
padding-top: 20px !important;
width: 100vw;
min-height: 500px;
text-align: center;
border-left: 1px solid #eee;
display: flex;
flex-direction: row;
background-color: black;
color: white;
margin-top: 100px;
position: relative;
}
#triangle5 {
width: 0px;
height: 0px;
border-left: 300px solid transparent;
border-bottom: 200px solid red;
border-bottom-right-radius: none;
bottom: 0;
position: absolute;
right: 0;
}
<div id="weekly-product-container">
<div id="triangle5"></div>
</div>
Upvotes: 1