![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Consider the following HTML: div class="links" img src="linkimages/logo.gif" h2>title</h2 span><a target="_blank" href="http://">http://</a></span p>description of link</p /div I have the following CSS: div.links { width:auto; margin:8px; margin-bottom:13px; border-bottom:1px solid; } div.links h2 {font-size:110%;text-align:left;} div.links span a{text-align:left;font-weight:bold;} div.links p{text-align:left;font-size:80%;} div.links img {float:left;padding:0px 10px 0px 0px;} Now in my HTML I have plenty of <div class="links"> the one under another. If the image is big and the description short then the image extends outside the div. How can I overcome this behavior and have a div that extends at 100% of the necessary height? (i have already tried height:auto with no luck) |
#3
| |||
| |||
|
|
On 2006-12-29, Harris Kosmidhs <hkosmidi (AT) remove (DOT) me.softnet.tuc.gr> wrote: Consider the following HTML: div class="links" img src="linkimages/logo.gif" h2>title</h2 span><a target="_blank" href="http://">http://</a></span p>description of link</p /div I have the following CSS: div.links { width:auto; margin:8px; margin-bottom:13px; border-bottom:1px solid; } div.links h2 {font-size:110%;text-align:left;} div.links span a{text-align:left;font-weight:bold;} div.links p{text-align:left;font-size:80%;} div.links img {float:left;padding:0px 10px 0px 0px;} Now in my HTML I have plenty of <div class="links"> the one under another. If the image is big and the description short then the image extends outside the div. How can I overcome this behavior and have a div that extends at 100% of the necessary height? (i have already tried height:auto with no luck) [1] divs _do_ grow to contain the divs inside them if they are themselves the "block formatting context boxes" for the floats, which they are if they are floated or positioned themselves. So we can fix this another way without moving the borders to extra separating divs by adding this to div.links: float: left; clear: left; width: 100%; |
#4
| |||
| |||
|
|
Ben C wrote: [snip] [1] divs _do_ grow to contain the divs inside them if they are themselves the "block formatting context boxes" for the floats, which they are if they are floated or positioned themselves. So we can fix this another way without moving the borders to extra separating divs by adding this to div.links: float: left; clear: left; width: 100%; yes it works thanks. But I would like to clear this out a bit. How float affects div's height? I thought float is used to position -maybe not the right word here, forgive my english- the element to its parent element. |
#5
| |||
| |||
|
|
div.links img {float:left;padding:0px 10px 0px 0px;} If the image is big and the description short then the image extends outside the div. How can I overcome this behavior and have a div that extends at 100% of the necessary height? |
![]() |
| Thread Tools | |
| Display Modes | |
| |