Side-by-side blocks using CSS

18,319

Use vertical-align:top;

.iLB {
    display: inline-block;
    vertical-align: top;
}​

JSFiddle: http://jsfiddle.net/97wDh/1/

Share:
18,319
Andrey
Author by

Andrey

Updated on June 04, 2022

Comments

  • Andrey
    Andrey almost 2 years

    I want to have block elements side-by-side. I don't don't want to use left, right, top, or anything similar.

    HTML

    <div class="iLB">LOLOLOL</div>
    <div class="iLB">
        This is content.<br/>
        This is content.<br/>
        This is content.
    </div>
    <div class="iLB">This, too?</div>
    

    CSS

    .iLB {
        display: inline-block;
    }
    

    Live demo: jsFiddle