CSS: Floats – the duct-tape of the webAdd to My Brief

| 4/10/2006

The CSS attribute “Float” is one of the most frustrating, yet useful attributes for styling the web. The number of times that annoying space, weirdly position element or randomly padded area can be fixed simply by using a float is one element of the web that you truly need to get a feel for. It’s not entirely predictable in its behaviour, even in the ‘standards compliant’ Mozilla browsers, although it is getting better.

But, like duct-tape, it can wear out, working in weird and not so wonderful ways. Such as Internet Explorer 6’s little habit of repeating the last few letters or words of a <div>tag every so often – fixed by using a second hidden div, that’s got lots of spaces in it. Or, the way that Mozilla based browsers sometimes forget to show the background unless the element is floated, even if the value is “none”. And the latest and greatest problem was an entire browser crash due to floated elements and hidden form fields – I think we may be the pioneers on this particular problem.

Over the years, I’ve learnt to manipulate and predict how these seemingly untamable beasts will behave, but on occasions this has meant re-writing the entire style sheet for a site, taking floats out, adding them in. Checking the widths and margins, trying desperately to find where that one elusive pixel is.

Floats are great though, and some of the things they enable you to do make it well worth the pain of learning how to use them, for a fully Web 2.0, CSS driven site.

Links
W3C - World Wide Web Consortium

tags: Technology

Interested in learning more?

Wiliam is a leading supplier of web solutions and can provide expert advice to assist your business or organisation online.

Make enquiry   Request quotation

Comments

Share this page

Print this page Email this page to a friend Bookmark and Share

No Brief added yet.

My Brief results-driven approach emphasises a commitment to our clients needs through strategic analysis and best-practice.

Add to My Brief

Click on this icon to save item into My Brief. Retrieve, email and print

Drag & Drop

Drag & drop any iten with this icon into My Brief. Retrieve, email and print

Search Blogs