problem aligning thumbnails in DIV

This is a discussion on "problem aligning thumbnails in DIV" within the Web Page Design section. This forum, and the thread "problem aligning thumbnails in DIV are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 7th, 2007, 15:44
SuperMember

SuperMember
Join Date: Apr 2007
Location: UK
Age: 31
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
problem aligning thumbnails in DIV

Hi All

Please help with this problem , it's driving me crazy!! Hopefully someone can look at my HTML or CSS and tell me what i'm doing wrong.

Check this link:
http://uk.geocities.com/johnson463@b...stcountry.html

All I want is to align 3 thumbnails across the main middle container DIV and have that structure repeat until the bottom of the document. However, this seems to start ok with the first 3 images but the next row shows 1 image only, aligned right? The 3rd row then looks ok but the 4th row has only 1 image and so on. each thumbnail is in its own DIV within the middle container div.

I have tried lots of toying with the width and alignments of the middlecontainer DIV and the nested DIV within , all to no avail.

Heeellllllp!

Thanks, Craig
Reply With Quote

  #2 (permalink)  
Old May 7th, 2007, 16:16
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem aligning thumbnails in DIV

Have you tried reducing the left and right margins of the div class "mainleft"?
My guess is that all of them side by side are just a little too wide to fit in the main container box..
Try... 30px on each instead of 40px. See if that bumps them all up.
Reply With Quote
  #3 (permalink)  
Old May 7th, 2007, 16:25
SuperMember

SuperMember
Join Date: Apr 2007
Location: UK
Age: 31
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem aligning thumbnails in DIV

Yes, tried that. The middlecontainer div is 700px wide. The mainleft div with the 3 thumbnails and 40px margin left and right equates to 690px so it does fit in.

I just experimented with adding the
HTML: Select all
height="100"
attribute to every thumbnail in the HTML. That worked all apart from the very first pic which is kinda aligned right (ish) on it's own now!

Oh, just checked in Firefox and it looks ok in that! Seems to be IE that displays the first thumbnail aligned strangely.

Last edited by Craigj1303; May 7th, 2007 at 16:28.
Reply With Quote
  #4 (permalink)  
Old May 7th, 2007, 18:05
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem aligning thumbnails in DIV

Did you upload the latest because it's still messed up like it was earlier...
Reply With Quote
  #5 (permalink)  
Old May 7th, 2007, 23:12
SuperMember

SuperMember
Join Date: Apr 2007
Location: UK
Age: 31
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem aligning thumbnails in DIV

I uploaded the latest version now.

I resolved the problem by increasing the height of the div above the thumbnails ("#right") by 5px. I'm not sure why it worked but it did!

I do have one minor cosmetic difference with this site when opened in Firefox & IE. In IE there is a small gap between the header image and the navbar below. In this gap, which is only around 1-2px, you can see the background image. However, in Firefox this gap is not apparent.

This is my first website so I wanted to do it right using CSS for layout. Can you see if there's anything obvious i've done incorrectly in relation to the CSS or HTML before I carry on much further?
Reply With Quote
  #6 (permalink)  
Old May 8th, 2007, 11:01
SuperMember

SuperMember
Join Date: Apr 2007
Location: UK
Age: 31
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem aligning thumbnails in DIV

Well I thought i'd solved it last night but apparently I am wrong. I tested the gallery page at home in Firefox 2 and IE7 and the 3 thumbnails lined up across the page just fine. I get to work today and have a look at the page in IE6 and low & behold.....this browser only displays 2 thumbnails next to each other and then puts the next 2 underneath.

It's like the 3 thumbnails in the nested DIV's don't fit in to the #gallerycontainer DIV but I don't see why not if it renders OK in IE7 & Firefox? I even experimented with widening the #gallerycontainer DIV by 50px and then the 3 thumbnails display but I want to keep the width 700px to keep in sync with the rest of the page.

My calculations are that the #gallerycontainer DIV is 702px wide (700px wide & 1px border each side).

The mainleft DIV's are 150px wide with a 41px margin left and right which to my mind calculates at 696px wide in total. So shouldn't that fit in the container??

I can reduce the margins left and right which makes it work in IE6 as well but then the thumbnails don't look centred in other browsers, it's like a vicious circle!

Here is the latest link:
http://uk.geocities.com/johnson463@b...stcountry.html

If you have the facility to check in IE6 & IE7 or Firefox you should see what I mean.
Reply With Quote
  #7 (permalink)  
Old May 8th, 2007, 11:55
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: problem aligning thumbnails in DIV

What I do in this situation is use <p></p> tags instead of div classes to hold all my photos.
Code: Select all
<div class="gallery">
<p> image with css applied to each image; another image, amother image </p>
<p>row two of images with css applied to each image</p></div>
css
Code: Select all
.image {
float: left
width: 150px;
margin-right 30px;
}
That's a thrown together version but maybe that will help you.
Reply With Quote
  #8 (permalink)  
Old May 8th, 2007, 14:31
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,763
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: problem aligning thumbnails in DIV

You can use a method similar to http://www.newguyinennis.com/photography as well.

Code: Select all

.thumbnail {
width:168px;
height:126px;
overflow:hidden;
float:left;
margin:6px 3px 6px 6px;
}
Code: Select all
<div class="thumbnail">
<img src="" width="" height="" alt="" />
</div>
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)

Last edited by moojoo; May 8th, 2007 at 14:33.
Reply With Quote
Reply

Tags
div

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
thumbnails position mars Flash & Multimedia Forum 0 Apr 21st, 2008 16:41
Problem aligning submit button in Firefox AdRock Web Page Design 3 Aug 16th, 2006 10:13
problem after vertical aligning bellefleur Web Page Design 5 Jun 29th, 2006 07:54
Positioning of Thumbnails c0ld4orm Web Page Design 13 Jan 5th, 2006 15:49
Thumbnails won't display rodesign Web Page Design 3 Mar 15th, 2005 07:07


All times are GMT. The time now is 00:28.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43