A better approach, use display: flex;
. Note that IE broswer older than IE11 are not supported. http://caniuse.com/#feat=flexbox
.row {
display: flex; /* equal height of the children */
}
.col {
flex: 1; /* additionally, equal width */
padding: 1em;
border: 1px solid gray;
}
<div class="row">
<div class="col">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</div>
<div class="col">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad omnis quae expedita ipsum nobis praesentium velit animi minus amet perspiciatis laboriosam similique debitis iste ratione nemo ea at corporis aliquam.</div>
</div>
A really simple example to put two div item side by side.
ul {
margin: 0;
/* removing the default ul margin */
padding: 0;
/* removing the default ul padding */
text-align: center;
}
li {
display: inline-block;
width: 45%;
}
.left {
background-color: aqua;
}
.right {
background-color: yellow;
}
<ul>
<li class="left half">foo</li>
<li class="right half">bar</li>
</ul>
8
solved How can i solve spaces problems?