tags:

views:

72

answers:

3

hello.

my CSS

ul{
overflow:hidden;
}
li{
display:inline-block;
}

my HTML

<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
<li>f</li>
<li>g</li>
</ul>

i want to align all my li items in one line, if i did that everything works fine except that when 3 or 4 li's fills the first line on my body they go the the second line, i want them to be on 1 line and everything after the 1 line is filled will be "hidden"

FOR EXAMPLE ::

// NOTE li holds sentences not just 1 letter

OUTPUT NOW ::

a               b                c              d
      e                  f               g

DESIRED OUTPUT ::

a                 b              c              d         e      f  //all of them in 1 line and the rest of them are hidden 'overflow:hidden'
+2  A: 

Try putting white-space:nowrap; in your <ul> style

edit: and use 'inline' rather than 'inline-block' as other have pointed out (and I forgot)

Ray
works like charm ..... THANKS A LOT
From.ME.to.YOU
A: 

Here is what you want. In this case you do not want the list items to be treated as blocks that can wrap.

li{display:inline}
ul{overflow:hidden}
if the desired effect is to have scrollbars to see the rest of the lin, the `overflow` should be `auto` -- `hidden` will cut the line off and the rest of it won't be seen on screen.
henasraf
+1  A: 

This works as you wish:

<html>
<head>
    <style type="text/css"> 

ul
{ 
overflow-x:hidden;
white-space:nowrap; 
height: 1em;
width: 100%;
} 

li
{ 
display:inline; 
}       
    </style>
</head>
<body>

<ul> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
<li>abcdefghijklmonpqrstuvwxyz</li> 
</ul> 

</body>
</html>
ck
+1, i tested the above snippet.It is working as expected: > http://jsbin.com/acaxo3/edit
Rakesh Juyal