Obejmowanie "floatów"

Facebook Twitter

CSS - Clearing floats - najnowsze rozwiązanie. Page last changed today A common problem with float-based layouts is that the floats' container doesn't want to stretch up to accomodate the floats.

CSS - Clearing floats - najnowsze rozwiązanie

If you want to add, say, a border around all floats (ie. a border around the container) you'll have to command the browsers somehow to stretch up the container all the way. Let's try it. This is the CSS we'll use throughout the page: Now this happens: Containing Floats (Complex Spiral Consulting) As powerful and useful as they are, floats can make for tricky layout tools.

Containing Floats (Complex Spiral Consulting)

Chances are that you may have seen something like the situation shown in Figure 1, which is accomplished with just two div elements, each with a floated image inside it. Figure 1. Gary Turner web development. Developers who are new to css, or those who work primarily in IE, run into a vicious “bug” in Firefox and other modern browsers.

Gary Turner web development

Their backgrounds disappear, or their borders do—but everything's fine in IE. The gnashing of teeth is heard throughout the land.