CSS Help

my question is basically the same as this: CSS: Horizontally scrolling image inside variable width div?.

I have a container Div that has Width:auto;, inside that I have a div with 4 rows of 150px by 150px images with a variable width. I would like to have the images take up the maximum height and overflow horizontally. I don't mind if I must use JavaScript, but would like to avoid it if possible.

css:

#slide1_controls span {
    padding-right:2em;
    cursor:pointer;
}
#slide1_container {
    height:650px;
    width:auto;
    position:relative;
    overflow:hidden;
}
#slide1_images {
    position: absolute;
    overflow-x: scroll;
    background-color:black;
    left:0px;
    -webkit-transition:all 1.0s ease-in-out;
    -moz-transition:all 1.0s ease-in-out;
    -o-transition:all 1.0s ease-in-out;
    transition:all 1.0s ease-in-out;
}
#slide1_images img{
    padding:4px;
    margin:0;
    float:left;
}

HTML:

<div id="slide1_container">
    <div id="slide1_images">
        <div id="panel">
            <a><img src="0" width="154" height="154"></a>
            <a><img src="1" width="154" height="154"></a>
            <a><img src="2" width="154" height="154"></a>
            <a><img src="3" width="154" height="154"></a>
            <a><img src="4" width="154" height="154"></a>
            <a><img src="5" width="154" height="154"></a>
            <a><img src="6" width="154" height="154"></a>
            <a><img src="7" width="154" height="154"></a>
            <a><img src="8" width="154" height="154"></a>
            <a><img src="9" width="154" height="154"></a>
            <a><img src="10" width="154" height="154"></a>
            <a><img src="11" width="154" height="154"></a>
            <a><img src="12" width="154" height="154"></a>
            <a><img src="13" width="154" height="154"></a>
            <a><img src="14" width="154" height="154"></a>
            <a><img src="15" width="154" height="154"></a>
            <a><img src="16" width="154" height="154"></a>
            <a><img src="17" width="154" height="154"></a>
            <a><img src="18" width="154" height="154"></a>
            <a><img src="19" width="154" height="154"></a>
            <a><img src="20" width="154" height="154"></a>
            <a><img src="21" width="154" height="154"></a>
            <a><img src="22" width="154" height="154"></a>
            <a><img src="23" width="154" height="154"></a>
            <a><img src="24" width="154" height="154"></a>      
        </div>
    </div>
</div>
<p id="slide1_controls">
    <span id="slide1-1">Image 1</span>
    <span id="slide1-2">Image 2</span>
    <span id="slide1-3">Image 3</span>
    <span id="slide1-4">Image 4</span>
</p>

$(document).ready(function() {
    $("#slide1-1").click(function() {
        $("#slide1_images").css("left","0");
    });
    $("#slide1-2").click(function() {
        $("#slide1_images").css("left","-450px");
    });
    $("#slide1-3").click(function() {
        $("#slide1_images").css("left","-900px");
    });
    $("#slide1-4").click(function() {
        $("#slide1_images").css("left","-1350px");
    });
});

I think the best thing to do would be to have the Div a certain height and width, and make all your images that height and width. Inside the div put a ul and li elements in it, which are styled to float left. Each li is contains a different image. Make sure that overflow is hidden in the div. Then, using Javascript, either triggered by a timed event or though user interaction, change the margin-left of the ul element to the negative of whatever the width of your images/div are. This will cause the li elements inside to move to the left, removing the first image from view and bringing the second image into the div to be seen.

You could also use JQuery to make the slide animation nice and smooth. If you want an example, I have this on my website www.tomrichardsonweb.co.uk on the front page. Hit crtl-u (cmd-option-u for mac) and it will show the code. I found this on another website so it isn't lisenced to me. Also, inspect ul element (chrome) and you will see how it changes the margin-left to change the image.

Hope this helps.

Thanks for you help but actually figured this out awhile ago.

Heres an old version of my script:

http://weneedaname.hostingsiteforfree.com/manraj/htdocs/scripts/mosaic.js

And to see it in action heres an super old version of the site I'm working on:

http://weneedaname.hostingsiteforfree.com/manraj/htdocs/

its on a free host so be patient, you can use left right arrows, N, B, A, D to make it slide.

To get CSS only horizontal overflow you 

a) make the parent div a fixed width and add the overflow-x:auto style

b) add child elements to the div that are wider than the parent

c) magic, a horizontal scrollbar

I can make an example but hopefully that gets you on the right track

*overflow-x isn't well documented, it's not supported in older browsers (think IE6) but works fine on pretty much everything else

I highly recommend jQuery. Here's just one sample of what you can do with it. http://nicolahibbert.com/demo/liteAccordion/

Can't you read FFS??? Help has been sorted. Thread is old. And yet you're bumping like you're having reading disorder (sorry if it offends you but you should know better)

SteelValor please don't bump old threads, it's annoying and most forums don't like it.