- This topic is empty.
-
AuthorPosts
-
September 24, 2010 at 9:26 am #30342brianatlargeMember
I’ve got several floated boxes with different heights. I’d like for everything to be pushed up together, but for some reason, it’s putting the next floated box at the same level as the bottom of the longest box.
Here’s a picture of that I’m talking about: http://twitpic.com/2rh0lp/full
Here’s the CSS for those boxes:
.jobFieldset {width:30%; float:left; margin-right:10px; margin-bottom:10px;}
Anyone have this happen before?
September 24, 2010 at 9:39 am #79123BobMemberAdd this after the last box in the row:
with CSS code:
.class {
clear: both;
}That should clear the floats, otherwise the last box will indeed jump down one line or so.. I don’t really know why, but it helps.
Edit: Read through this, it might have some important info about the floats and clearing floats, probably better the way I explained it. Actually, after quickly looking at that article, I’m not sure my solution is correct :P
September 24, 2010 at 12:04 pm #79116brianatlargeMemberSo I put in the clear div after the third box, and it helped a little, but it’s still aligning to the longest box.
September 24, 2010 at 12:15 pm #79105TheDocMemberI’ve got several floated boxes with different heights. I’d like for everything to be pushed up together, but for some reason, it’s putting the next floated box at the same level as the bottom of the longest box.
Unfortunately, that’s not how floats work. The latest screenshot that you’ve provided is exactly what a user should expect with floated boxes that have “clears” properly applied to them. If you want lots of different boxes of different heights to all be together, you’ll have to go beyond CSS.
September 24, 2010 at 1:09 pm #79107kevsyersParticipantThe flow of the boxes are working like they should. Are these boxes automatically generated? If not, why not have 3 wrapper divs that contain 2 boxes (stacked on top of each other). then float the wrapper divs.
Hope my suggestion makes sense
September 24, 2010 at 1:33 pm #79108brianatlargeMemberWrapping the boxes in floated containers was my plan b, just wasn’t sure if there was a trick I was missing.
Thanks.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.