09
Feb
08

Floats, CSS, Divs, the Refresh Button, Firefox, and Frustration






Wordpress is a funny beast, really it is.  Usually, building a Wordpress site involves something like digging through a hundred pages of templates until you find one that’s merely passable.  Once you do, you grab it and start hacking away at everything to make it your own - CSS, HTML, everything.  And it’s fine.  Really, it is - the internet’s built on sharing ideas.  The problem appears once you start inheriting other people’s problems.  In this case, I had to hit the refresh key just to get my divs to float correctly.

The thing with using a tableless design is that people tend to create an outer division to put other inner divisions into.  Usually this looks like a main content box with two columns in it, which is what I had.  In order to get those columns to line up side by side, you tell the css of those divs to float:left;.  Here’s where we inherit the problem, however.  When I visit the page for the first time, or reload the page without using the cache, the floats start clearing one another, even though I have never set a clear css property on either of the divisions.  (If you don’t know what I mean by “clearing”, imagine you want to put two columns side by side, and instead they stack on top of one another.)  The whole ordeal was rather frustrating, until I noticed one thing.

The outer, main content division had a property from before I started editing the css.  The outer div was set to display:table;.  I don’t know if it’s a bug, but the issue remains:  If you have an outer div set to display:table, the inner divs will clear each other regardless of how you float them.  The solution?  I didn’t need the outer div to act like a table, so I just removed the display:table; property and now all is well.

I don’t know if you’ll be able to remove the display:table; property from your outer div, but you’ll have to find a way around it if this problem occurs in Firefox for you.  I hope this helps someone track their problem down.


16 Responses to “Floats, CSS, Divs, the Refresh Button, Firefox, and Frustration”


  1. 1 web pixy Mar 19th, 2008 at 3:46 am

    I totally agree with you that Wordpress has it’s problems and they are mainly these little things that are so hard to notice but they can drive you crazy. It’s good to know about this display:table property if someday I have the same problem, thanks for sharing:)

  2. 2 Maarten May 23rd, 2008 at 4:55 am

    You’re my hero. BTW excellent title

  3. 3 Web Based Aug 1st, 2008 at 3:09 am

    Agreed with you. But a programmer has to do some think to overcome these issues.

  4. 4 Terrible Twos Oct 13th, 2008 at 5:36 pm

    Thanks for posting this. I’m having a tough time getting my site to display properly on initial loading in FF. If I refresh, it works just fine in FF, but not when the cache is empty. Very weird !!

  5. 5 Pete Oct 16th, 2008 at 3:18 am

    A most helpful post.

    Thanks!

  6. 6 right Nov 26th, 2008 at 5:43 am

    Thanks for pointing that out, but I already found out about that. I need a solution for this problem, not a diagnosis.

  7. 7 right Nov 26th, 2008 at 5:44 am

    Btw, I nééd the display:table or an alternative.

  8. 8 Jon Dec 2nd, 2008 at 7:09 am

    @right:

    Your money will be refunded for the use of this website.

  9. 9 Website Design Dec 18th, 2008 at 9:27 pm

    Quite informative post. Keep up the good work.

  10. 10 John Mackenzie Mar 4th, 2009 at 3:40 am

    It’s a strange problem, doesn’t seem to exist in IE though. Why removing display:table should resolve it is beyond me, but if it works it works I guess!

    Good to finally find an article with some practical help on this issue.

  11. 11 ben Apr 21st, 2009 at 7:13 am

    fantastic blog this is what ive been looking for cheers web development

  12. 12 kermitt Jun 3rd, 2009 at 3:21 am

    man, you saved my life with this post, i’ve been trying to solve this crap for months:P

  13. 13 création web joomla Jul 8th, 2009 at 4:50 pm

    Hello,

    I’m looking for VirtueMart freelance developer or web designer webdesign.

    Installing the site and I need someone to add functions to some site.

    If you are interested thank you kindly send us a resume by mail.

  14. 14 kurye Aug 26th, 2009 at 2:56 am

    Floats, CSS, Divs, the Refresh Button, Firefox, and Frustration | Webinade - Web Development & Programming Blog great article thank you.

  1. 1 CSS Floats vs. Firefox- Kirawat Sahasewiyon Pingback on Nov 13th, 2009 at 8:37 pm
  2. 2 refresh button - StartTags.com Pingback on Feb 2nd, 2010 at 11:27 am

Leave a Reply




Close
E-mail It