Reputation: 2540
I have two div columns, and a button inside each column. I want each button align to the center bottom of each column. So far I can get it in the center or at the bottom, but not for both.
.rr_centerbottom1 {
display: block;
margin-left: 5%;
margin-right: 5%;
position: absolute;
bottom: 5px;
}
.header {
position: relative;
min-height: 180px;
}
<div class="pure-g header">
<div class="pure-u-12-24">
<!-- colomn 1 -->
<a href="test.html" class="pure-button rr_centerbottom1" type='button'> Info</a>
</div>
<div class="pure-u-12-24">
<!-- colomn 1 -->
<a href="test2.html" class="pure-button rr_centerbottom1" type='button'>Boek nu</a>
</div>
</div>
Upvotes: 2
Views: 1799
Reputation: 7299
Are you looking for something like this??
.rr_centerbottom1 {
position: absolute;
bottom: 0px;
width: 100%;
text-align: center;
font-weight: 900;
}
.pure-button {
text-decoration: none;
}
.pure-u-12-24 {
display: inline-block;
border: 1px solid red;
width: 200px;
position: relative;
min-height: 180px;
}
<div class="pure-g header">
<div class="pure-u-12-24">
<!-- colomn 1 -->
<p class="rr_centerbottom1"><a href="test.html" class="pure-button" type='button'> Info</a>
<p>
</div>
<div class="pure-u-12-24">
<!-- colomn 1 -->
<p class="rr_centerbottom1"><a href="test2.html" class="pure-button" type='button'>Boek nu</a></p>
</div>
</div>
Upvotes: 1
Reputation: 11
if I understand you correctly, you want to have the links in the bottom of each column, but centered of that each column.
Since i see you already using position: absolute and some kind of GRID system, which probably doesnt use flexbox already, you can try this:
.rr_centerbottom1 {
display: block;
margin-left: 5%;
margin-right: 5%;
position: absolute;
bottom: 5px;
left: 0; right: 0;
text-align: center;
bordeR: 1px solid blue;
}
.header {
position: relative;
min-height: 180px;
}
.pure-u-12-24 {width: 200px; height: 100px; float: left;overflow: hidden;position: relative; bordeR: 1px solid red;}
Basically you are giving the links a left and right property, to strecth it to full width, and then give it a text align center. If the button is styled button div, you can make it a displaY: inline-block and nesting it in another div that has the left: 0 and right: 0. Btw you could also use width 100%.
Here is a jsfiddle, I added borders to make it clear: https://jsfiddle.net/aLut9pg9/3/
Upvotes: 1
Reputation: 78676
I suggest to use flexbox:
.header {
min-height: 180px;
display: flex;
}
.header > div {
border: 1px solid;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
<div class="pure-g header">
<div class="pure-u-12-24">
<!-- colomn 1 -->
<a href="test.html" class="pure-button rr_centerbottom1" type='button'> Info</a>
</div>
<div class="pure-u-12-24">
<!-- colomn 1 -->
<a href="test2.html" class="pure-button rr_centerbottom1" type='button'>Boek nu</a>
</div>
</div>
Upvotes: 1