Tuesday, July 13, 2010

Adding Extra Markup

This is an outdated method, but is an easy option. Simply add an extra element at the bottom of the container and “clear” it. Here’s how the HTML would look after this method is implemented:

some content


And the resulting CSS applied to the new element:

.clearfix {
clear: both;
}

You could also do this by means of a
tag with an inline style. In any case, you will have the desired result: the parent container will expand to enclose all of its children. But this method is not recommended since it adds nonsemantic code to your markup.

No comments: