This depends on your CSS that is associated with the different classes/ids/elements in your HTML.
<div class="clear"></div>
ALWAYS has some css associated with it, that is:
.clear { clear: both; }
The above CSS is what makes it prevent that floating issue. That said... Using a "clear div" as you have shown above is one of many ways to do this.
In your particular case, given this HTML:
<div class="row">
<div class="col col_1">col_1</div>
<div class="col col_7">col_7
<div class="row">
<div class="col col_3">col_3</div>
<div class="col col_4">col_4</div>
</div><!-- row -->
</div>
</div><!-- row -->
</div><!-- col_8 -->
It is very likely that the class of "row" has the clear: both;
property in CSS. That would explain why when you remove the clear div, it stayed the same. Essentially you didn't need the clear div, because the row class already has the CSS attached to it to prevent that issue from happening.
The selector probably looks like this: .row { clear: both; }
The .row
class probably has other CSS associated with it as well, another very likely property is overflow: hidden;
That property can also effect how your divs and surrounding divs interact/behave next to each other.
To summarize: It is NOT
the HTML <div class="clear"></div>
that prevents this floating issue from happening. It IS the CSS property and value clear: both;
which can be applied to any HTML element that prevents the issue from occurring.
Some resources: CSS Wiki on Overflow property CSS Wiki on Clear property
Hopefully this clears that up for you? (pardon the pun haha)