I'm trying to get a button to position at the bottom of a div.
I'm using the position:absolute
for the button and setting the parent div to position:relative
.
But for some reason, the button at the bottom overlaps over the content once the content extends down. I'm not sure what's causing it to overlap.
Here's a fiddle: http://jsfiddle.net/LHxeP/8/
Here's my CSS:
.a{
width: 33%;
float: left;
border: 1px solid red;
position: relative;
text-align: center;
padding: 2%;
}
img {
display: block;
width: 100%;
max-width:150px;
height: auto;
margin: 2% auto;
}
.button{
position: absolute;
bottom: 5px;
background: green;
display: block;
left: 50%;
width: 50%;
margin-left: -25%;
border-radius:10px;
}
I'm not sure if it has something to do with the initial height being set on the parent elements either. I know that some of the content will vary within each div which will extend the height of the div.
I have a jQuery script that will check the longest height parent div and then the rest of the child elements to match the longest div, hence the inline height.
I hope that makes sense. It's been a long night.