Results 1 to 2 of 2

Thread: css float (image gallery) question

  1. #1
    Join Date
    Apr 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default css float (image gallery) question

    question about the css float function:

    attempt to make a simple image gallery with expanding images on thumbnail click: http://www.kulsdom.com/newstoday/images/

    my problem is this. the layout now looks like:
    example 1 - http://www.kulsdom.com/newstoday/images/layout_now.jpg

    and i want it to be like this:
    example 2 - http://www.kulsdom.com/newstoday/ima...out_wanted.jpg

    so, without all the gaps showing in example 1.

    can that easily be done with another use of the float function? or does it need a javascript function?

    thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Instead of having your images expand in place, you could use a script like:

    Image Thumbnail Viewer II

    and either use a table to put the large image area (in the script the 'dynloadarea') in the center cell of a 3 column row with the small images split between the left and right cells, or float some images to its left and some to its right.

    The thing with float is that, given fixed width elements (like images), they will float to the edge of the container if pushed there by the other content that they are floating around. If that content is also fixed width and if that container is the body, then the window width will determine if the image needs to wrap to the next line or not. If you use a container division, then you can give it enough width to prevent wrapping but, on smaller screens/in smaller windows it will cause a horizontal scrollbar. The same is basically true with a table, it will assume the width required for its content and if that is greater than the window's or container's width, a horizontal scrollbar will appear or the content may bleed and wrap. So, in general, with images and especially with dynamically resizing ones, it is best to keep things small enough so that they will fit horizontally on an 800x600 screen. Your page can be wider but, the extra width should be accounted for using elements (usually text) that can wrap without causing the layout to look bad.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •