Mysterious disappearing forms in Safari

I’m used to dealing with incorrect CSS rendering, lackluster AJAX support, memory leaks, and all the rest of it in IE. But the other day I came across something new and baffling - and it’s not an IE problem, so it was a huge Whiskey-Tango-Foxtrot* moment.

The problem: In Safari (2.0.3), nothing within the <form></form> tags was showing up. But if I removed the opening <form> tag, the inputs, labels, etc. showed up as expected!

After much head-scratching, fruitless Googling, and futzing with HTML and CSS, I found the fix: the form was inside a div, and when I applied display: block to the containing div, all the form elements showed up correctly!

I guess that’ll be one more for the Quirksmode list of Safari bugs!

Update: This happens only if the containing div has the clearfix class applied.

* h/t Rusty

5 Responses to "Mysterious disappearing forms in Safari"

  1. Patrick Fitzgerald says:

    Hacks are bad, mmmm-kay?

  2. Amber says:

    It’s not really a hack, though. A div would be displayed as a block anyway, so it’s more like just restating the obvious (which apparently Safari has a problem with).

  3. Patrick Fitzgerald says:

    Oh, I meant the clearfix thing. ;-)

  4. Amber says:

    Hwhaht?? You’re the one who originally told me about clearfix!

    I hope you’re more consistent as a parent than as an imparter (sp?) of CSS wisdom!

  5. Patrick Fitzgerald says:

    I told you about it but I didn’t say to actually use it. ;-)

    Actually I would use it in cases where I didn’t have control of the HTML and needed to clear some floats. But I prefer to just add a clearing div.