I have a gallery of thumbnails in a div floated left so they all sit next to each other. When the amount of thumbnails don't equate to a full line I'd like the container div's coloured background to show.

If you view link you can see it as I'd like - the bluey colour filling the last line - I have done this by specifying an exact height on the container div - how do I make this automatic?

1 answer

2
points
This was chosen as the best answer

When clearing floats, be sure to place the clearing element within the parent element. In your case, take <br style="clear:left;" /> and move it into #gallery, as opposed to after it. Otherwise, the break tag is trying to clear the float of the parent element itself (of which it doesn't have).

Answered almost 6 years ago by Vinny Burgh
  • That's fixed it - thanks :-) Liam Brazier almost 6 years ago