Skip to content

Instantly share code, notes, and snippets.

@pixmin
Created May 23, 2018 14:48
Show Gist options
  • Select an option

  • Save pixmin/a3232b9a48edca845103faa53cd336cc to your computer and use it in GitHub Desktop.

Select an option

Save pixmin/a3232b9a48edca845103faa53cd336cc to your computer and use it in GitHub Desktop.
CSS - display: inline-block

html

<section>
    <article>
        <h2>un h2</h2>
        <p> un paragraph un paragraph un paragraph un paragraph</p>
    </article>
    <article>
        <h2>un h2</h2>
        <p>un paragraph</p>
    </article>
    <article>
        <h2>un h2</h2>
        <p>un paragraph</p>
    </article>
    <article>
        <h2>un h2</h2>
        <p>un paragraph</p>
    </article>
</section>

css

section {
    font-size: 0.1px; /* IE 9/10 don't like font-size: 0; */
}
article {
    width: 25%;
    display: inline-block;
    text-align: justify;
    font-size: 1rem;
    vertical-align: top;    
}
article:after {
  content: '';
  width: 100%; /* Ensures there are at least 2 lines of text, so justification works */
  display: inline-block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment