I’m trying to align only the social media (instagram/facebook) so that they are all resting on the same row, while keeping the colorblocks of unknown height (since these are meant to be responsive logos) as they are (vertically centralised to one another).
Any comments on how to do so? I’m also working with twitter bootstrap.
Thanks in advance for any help given.
HTML
<div class="row logoLocation vertical-align">
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 kite vcenter">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 kiteSocialMedia">
Facebook/Instagram
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-12 col-xs-12 supermarket vcenter">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 supermarketSocialMedia">
Facebook/Instagram
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 koskos vcenter">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 koskosSocialMedia">
Facebook/Instagram
</div>
</div>
</div> <!--row -->
CSS
.vertical-align{
display:flex;
align-items:center;
}
.kite{
width:200px;
height:200px;
background-color:red;
float:left;
}
.supermarket{
width:150px;
height:150px;
background-color:blue;
float:left;
}
.koskos{
width:175px;
height:400px;
background-color:green;
float:left;
}
3
Answers
If you want to keep some elements in same row, you have to divide the row.
You can divide in any combination. Like:
4+4+4, 3+3+3+3......=12
You can try
position:absolute;
. Adjust thetop
value for responsive screens.Firstly, you would have to make all your divs the same height.
You can use flexbox for that.
Then push the “SocialMedia” div to the bottom either again using flexbox or absolute positioning if the image is to be vertically centered in the div.
Codepen Demo (using flexbox).