The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
Confused by tile layout with floats. So close, yet so far...
Discuss Confused by tile layout with floats. So close, yet so far... in the CSS Help forum on Dev Shed. Confused by tile layout with floats. So close, yet so far... Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 27th, 2012, 09:52 AM
|
|
|
|
Confused by tile layout with floats. So close, yet so far...
Good morning. Our designers have come up with a tile layout for a page we are working on. As the web guy, I'm tasked with making it functional. I'm having a hard time wrapping my brain around all the floats involved, and I've gotten all but one tile into place. But for the life of me, I can't figure out how to get it where it needs to be, so I thought I'd come here for a fresh pair of eyes.
http://jsfiddle.net/jTvWQ/
div5 (red) is the offender. I have tucked it down at the bottom for now, since it was messing up the rest of the layout. It goes in the empty white space to the right of the orange div6, and under the teal div4.
I can make it work if I swap div4 & div5 with div6, as shown here: http://jsfiddle.net/8b6Jx/, but any of you who have worked with designers before know that they are pressuring me to stick to their original design.
Thoughts?
|

December 27th, 2012, 02:27 PM
|
|
|
|
What about having two containing divs for the left and right of the block of tiles, which would then make it much easier to position / float each box within each of the containing divs (sort of like 2 columns)?
|

December 27th, 2012, 05:07 PM
|
|
|
|
Ah, of course. I've done this very thing lots with regular layouts, but this is my first tile layout, and I just never thought to apply this.
I'll give that a try here.
|

December 28th, 2012, 01:51 AM
|
|
|
Of course that wouldn't work if you didn't have that type of tile layout  So maybe another option is to position each tile relatively (just throwing another thought into the pot).
|

December 28th, 2012, 10:27 AM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
Quote: | Originally Posted by simplypixie Of course that wouldn't work if you didn't have that type of tile layout  So maybe another option is to position each tile relatively (just throwing another thought into the pot). |
Adding an additional <div> as a wrapper around div4 and div5 is a much more robust solution. Relative positioning is really only good for making small adjustments in position (or sometimes to swap the position of two columns).
|

December 29th, 2012, 01:48 AM
|
|
|
Quote: | Originally Posted by Kravvitz Adding an additional <div> as a wrapper around div4 and div5 is a much more robust solution. Relative positioning is really only good for making small adjustments in position (or sometimes to swap the position of two columns). |
Totally agree - I very rarely use relative positioning for anything to be honest
|

January 2nd, 2013, 01:12 PM
|
|
|
Quote: | Originally Posted by Kravvitz Adding an additional <div> as a wrapper around div4 and div5 is a much more robust solution. Relative positioning is really only good for making small adjustments in position (or sometimes to swap the position of two columns). |
Ah, your comment is a good tip as well. This particular design allowed me to break the layout into two columns, so that's what I did based on the suggestion above. But your suggestion of simply adding a wrapper div around the two offending divs would have worked brilliantly as well, especially if my layout did not permit such a clean column split down the middle.
I wanted to make sure I highlighted and affirmed your response for others who may stumble upon this thread. Thanks! 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|