DrXCheng
DrXCheng

Reputation: 4132

How to force inline-block wrap to new line using CSS or jQuery?

I have ten items. How do I make it to two lines, each having five items?

HTML:

<ul>
    <li>item1</li>
    <li>item2</li>
    //...
    <li>item5</li>
    //newline
    <li>item6</li>
    <li>item10</li>
<ul>

CSS:

ul li { display: inline-block; }

Note, I have to use inline-block instead of inline.

Upvotes: 0

Views: 3061

Answers (1)

Zoltan Toth
Zoltan Toth

Reputation: 47667

You can try this

$( "ul li" ).eq( 4 ).after( "<br />" );

DEMO

Upvotes: 4

Related Questions