I need help with aligning three divs, named a, b, and c. Each div is set to 48% width and displayed as inline blocks. Div a will always be shorter than div b, creating a gap between the bottom of a and the top of c. The heights of a and b may vary on different pages, hence using margin-top:-10px might not work consistently.
Current layout:
Desired layout:
Edit
Mobile:
CSS
div {
width:48%;
box-sizing:border-box;
display:inline-block;
border:1px solid;
vertical-align:top;
}
@media only screen and (max-width: 600px) {
div {
width:100%;
}
}
HTML
<div style="border-color:red;">a<br>a</div>
<div style="border-color:green;">b<br>b<br>b<br>b<br>b<br>b<br>b<br>b</div>
<div style="border-color:blue;">c<br>c<br>c<br></div>
The media query ensures that the three divs are stacked in one column on smaller screens. Hence, the order of the divs matters.