0

Using a list as;

<ul id="scroller">
    <li><img src="../static/image/brand1.png" title="brand title"></li>
    .....
</ul>

And with css properties;

    ul#scroller li {
        list-style: none;
        display: inline;
    }

    ul#scroller li img{
        margin-left: 75px;
        float:left;
    }

    ul#scroller {
        overflow: scroll;
    }

and the YUI CSS reset just before this definition.

The problem is; instead of the horizontal scroll, my list items are line breaking.

Peace

3
  • You mean like here, where you might get two rows of Beaker? jsfiddle.net/userdude/YMDCw Commented Apr 7, 2012 at 22:06
  • exactly, just add a couple more list items. they need to overflow 'horizontally' but they are linebreaking.. Commented Apr 7, 2012 at 22:10
  • i would actually try setting float: left directly in the li, though I cannot see obvious reason for this :) Commented Apr 7, 2012 at 22:24

2 Answers 2

1

You can add "white-space:nowrap;" to the ul#scroller element.

http://jsfiddle.net/YMDCw/7/

ul#scroller{
    white-space:nowrap;
}
ul#scroller li {
    list-style: none;
    display: inline;
}

ul#scroller li img{
    margin-left: 75px;
}

ul#scroller {
    overflow: scroll;
}
​
Sign up to request clarification or add additional context in comments.

1 Comment

@xatanian, Forcing the element not to wrap, isn't the perfect way
0

I think you want the css like this?

ul {
    height: 150px;
    width: 300px;
    overflow: auto;
    overflow-y: hidden !important;
    overflow-x: scroll !important;
}

li {
    list-style: none;
    min-width: 800px;
}

img {
    list-style: none;
    display: inline-block;
    float: left !important;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.