Hello,
very often when using the float-property I do have problems with positioning
the element in its parent container. And/Or the parent container behaves
confusingly regarding its height.
An example:
<html>
<head>
<style type="text/css">
div#content {
border:1px red solid;
padding-top: 10px;
}
a {
padding: 8px;
}
a#first {
float:right;
}
a#second {
/* float:left; */
}
</style>
</head>
<body>
<div id="content">
<a id="first" href="foo1">Fir st</a>
<a id="second" href="foo2">Sec ond</a>
</div>
</body>
</html>
Questions:
In this example the first (floating) link is no more positioned completely
inside the content-div. Why does this happen?
When setting float:left for the second link the content-div collapses to
just a few pixels of height. The links are then placed below the
content-div. Why does this happen? I had expected that the div still
encloses the links.
I feel like missing a very fundamental conception of the float-property.
Where could I read about more details about this? Does anybody know a good
online-ressource (or maybe a offline book) about this?
Thank you,
Gert
Comment