I want to float div next to each other which is having variable height. I am using display inline-block to float div next to each other, How can I remove the extra space between each block ?
(How can i remove the highlighted yellow space below)
Below is my code
body {
font-family: "Tahoma", Geneva, sans-serif;
font-size: 15px;
}
.block,
.block li {
display: block;
}
.block {
width: 960px;
margin: 10px;
padding: 10px;
background: rgba(0, 80, 140, 0.3);
}
.block li {
display: inline-block;
vertical-align: top;
list-style: none;
background: rgba(255, 0, 0, 0.4);
width: 290px;
margin: 0 10px 10px 0;
padding: 5px;
}
.block li:nth-child(3n) {
margin: 0 0 10px 0;
background: rgba(0, 255, 0, 0.6);
}
.block li:nth-child(3n-1) {
background: rgba(0, 0, 255, 0.5);
}
<ul class="block">
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />Enough content for now.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />More content please.
<br />And some more
<br />Enough content for now.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />Enough content for now.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />More content.
<br />Even more content.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />Enough content for now.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />More content.
<br />Even more content.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />Enough content for now.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />More content.
<br />Even more content.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />
</li>
<li>
Some content here.
<br />More content.
<br />Even more content.
<br />Enough content for now.
<br />
</li>
</ul>