Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML/CSS Whitespace breaking

Tags:

html

css

I am wondering why with markup like

http://jsfiddle.net/rkEpx/

I get

As you can see, the 1st and last menu items have its link broken into 3 lines even tho theres enough space to expand. Is it possible to have the line not break unless theres really no space? If possible without setting a fixed width or using non-breaking spaces?

like image 657
Jiew Meng Avatar asked Jan 07 '11 14:01

Jiew Meng


2 Answers

  HTML entity or white-space: nowrap; CSS. But it won't break even if there is really no space.

You can try using display: inline-block; instead of float: left; for your li, img and / or p.

http://jsfiddle.net/2Mv2E/

like image 86
Habax Avatar answered Sep 24 '22 14:09

Habax


Try adding:

li {
    padding: 0;
    margin: 0 3px 0 0;
    float: left;  
    max-width: 120px;
white-space: nowrap;
}
like image 20
Diablo Avatar answered Sep 24 '22 14:09

Diablo