...

View Full Version : Horizontal scrolling div stretch to content



tomrshl
11-02-2009, 10:35 PM
Hi, I have an <ul> of images styled as display:inline

Can I have the div they are in overflow:auto horizontally without setting a width?

In other words stretch the div to fit a horizontal line of images instead of them breaking onto a new line?

abduraooft
11-03-2009, 08:25 AM
Hi, I have an <ul> of images styled as display:inline

Can I have the div they are in overflow:auto horizontally without setting a width?
Please post your current code or a link to your page and explain the issue/requirement, rather than giving a puzzle in your thread.

Excavator
11-03-2009, 08:32 AM
Hello tomrshl,
I've never been able to do it. The div with the scroll bar needs a width and the img container takes it's width from that, inless you specify otherwise.
I have an example here: http://nopeople.com/CSS/scrollers/index.html

tomrshl
11-03-2009, 06:41 PM
* {
margin: 0;
padding: 0;
}

body {
font-family: "Helvetica", "Arial", sans-serif;
font-size: 12px;
}

#container {
width: 100%;
height: 100%;
}

#main {
overflow: auto;
white-space:nowrap;
text-align: left;
position: absolute; top: 100px; left: 0; right: 0; bottom: 0;
}

#header {
height: 100px;
text-align: left;
position: fixed; top: 0px; left: 0;
width: 100%;
}


ul, li {
display: inline;
}

This is what I worked out, seems to work as I wanted.

Thanks anyway



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum