PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed May 23, 2018 1:29 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Oct 16, 2008 11:40 am 
Offline
Forum Contributor

Joined: Sun Jun 08, 2008 11:25 pm
Posts: 186
I just found a ridiculous problem as I try to improve my CSS skills. If you ever try to make a container DIV, and then inside put a left and right column DIV where the left is a fixed width and a float left, and the right is a float left, you may find that the container DIV collapses into like 1px above the two floating DIVs inside it!

The fix was to make the container DIV have a float: left on it. If that's not the stupidest thing in the world.

CSS -- it's a black art.


Top
 Profile  
 
PostPosted: Thu Oct 16, 2008 2:09 pm 
Offline
Forum Regular
User avatar

Joined: Wed Jul 19, 2006 7:29 am
Posts: 749
That's because you have to clear the floats. Floating the container is not the best solution how to do it since you are adding another float.
Best solution I have seen so far is
Syntax: [ Download ] [ Hide ]
#container { width: 100%; overflow: hidden; }

There doesn't have to be width, there can be any property which forces container to have layout. It's for IE.


Top
 Profile  
 
PostPosted: Thu Oct 16, 2008 3:36 pm 
Offline
Forum Contributor

Joined: Sun Jun 08, 2008 11:25 pm
Posts: 186
Hmm. Stay tuned. Let me try that!


Top
 Profile  
 
PostPosted: Thu Oct 16, 2008 3:46 pm 
Offline
Forum Contributor

Joined: Sun Jun 08, 2008 11:25 pm
Posts: 186
Yep, that can work too. So, does the float technique slow the page down a little?


Top
 Profile  
 
PostPosted: Fri Oct 17, 2008 3:47 pm 
Offline
Forum Regular
User avatar

Joined: Wed Jul 19, 2006 7:29 am
Posts: 749
Even if it is a little slower, then it's not noticeable.
I guess to calculate floating div widths browser would need a little more processing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group