Click here to Skip to main content
Sign Up to vote bad
good
See more: CSSHTMLjQuery
Hi All,
 
I am stuck on a simple CSS problem, but can't seem to find a fix!
 
I am building a custom pagination system (ex p1 - p2 - p3 - p4 - p5 etc).
 
Each 'page number' is a LI, with CSS as:
 

ul.simplePagerNav li
{
    display: block;
    float: left;
    padding: 10px;
    margin-bottom: 10px;
    font-family: georgia;
    font-size: 14px;
}
 

The UL containing all the LI's are placed inside a DIV.
 
The DIV's CSS at the moment is:
 
<pre lang="css">#startSimplePagerNav
        {
            overflow: auto;
            width: 500px;
            height: 70px;
            white-space: nowrap;
        }</pre>
 

However, what I would like to achieve, is to have all the LI's in a long row, with a horizonal scrollbar only, so that users can scroll left and right to see the different page numbers, and not up and down.
 
At the moment, the text in the DIV runs down vertically, with the scrollbar appearing on the right.
 
Currently:
p1 - p2 - p3 - p4 -
p5 - p6 - p7 - p8
 
What I would like:
p1 - p2 -p3 - p4 - p5 - p6 - p7- p8
 

Can anybody help, please?
Posted 9 Jan '13 - 8:27


1 solution

This works for me in IE8:
 

          .nav-holder
          {
            overflow-x: auto;
            white-space: nowrap;
            width:100px;
          }
          
          .nav-item 
          {
                display: inline-block;
                width: 25px;
                white-space: normal;
          }
 
          <div class="nav-holder">
                <ul>
                        <li class="nav-item">p1</li>
                        <li class="nav-item">p2</li>
                        <li class="nav-item">p3</li>
                        <li class="nav-item">p4</li>
                        <li class="nav-item">p5</li>
                        <li class="nav-item">p6</li>
                        <li class="nav-item">p7</li>
                        <li class="nav-item">p8</li>
                        <li class="nav-item">p9</li>
                </ul>
          </div>
 
Not sure about other browsers as I'm at work and don't have access to them, but I believe this should work.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Arun Vasu 394
1 OriginalGriff 370
2 Sergey Alexandrovich Kryukov 313
3 Tadit Dash 213
4 Maciej Los 191
0 Sergey Alexandrovich Kryukov 9,955
1 OriginalGriff 7,589
2 CPallini 4,028
3 Rohan Leuva 3,422
4 Maciej Los 2,949


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid