So I have some DIVs. The structure is this
<div id="content">
<div id="lcol">some content</div>
<div id="lcol">some<br />content</div>
</div>
And my problem is that the two divs are of different height. I'm using display:inline-block
for 'lcol' while 'content' is just a regular div. The two lcol divs do indeed show up side by side, but they are anchored at the bottom of the div. I would like them to be aligned to the top of the div. I tried adding vertical-align:top
to 'content' but nothing happened.
Any ideas?
JsFiddle: http://jsfiddle.net/qxe8h/1/
To align two <div> elements vertically in Bootstrap 3, you can try using the CSS Flexible Box Layout. In the example below, we display the needed row as a flex container box with the CSS display property and then, align the flex-items (columns) vertically with the align-items property.
Inline block divs can be centered by applying text-align:center to their parent.
To center both vertically and horizontally, use padding and text-align: center : I am vertically and horizontally centered.
With CSS properties, you can easily put two <div> next to each other in HTML. Use the CSS property float to achieve this. With that, add height:100px and set margin.
Give vertical-align:top to your inline-block elements. Write like this:
#lcol {vertical-align:top;}
Check this http://jsfiddle.net/qxe8h/2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With