Forum Moderators: not2easy

Message Too Old, No Replies

Div - overflowing pictures

The divsize isn't determined by the imagesize..

         

saZmer

2:29 pm on Jun 13, 2007 (gmt 0)

10+ Year Member



Hello!

I have this annoying problem with resizing text. I use the ctrl+scroll in FF to resize the text and it works wonderfully.

I have these small divs with text and images and when I resize the divs also resize since I didn't set the size. That's all good, but the div should stop resizing when it reaches the image. Meaning that the div should get smaller then the image! I have borders on the divs so it looks really weird when you shrink the text too much.

I determined that it depended on me having float:left; set on the images which apparantly also effected the divs. I can solve the problem with using a small table instead but I don't really want to.

Is there a way around it in CSS?

Examples:

#kolumnbox1 {margin: 0px 0px; padding: 2em 1em; border-left: 1px solid #336699; border-right: 1px solid #336699; background: #ffffff; vertical-align:middle;}

<!-- -------------- not working ---------- -->

<div id="kolumnbox1">
<img style="float:left; border: 2px solid #336699; margin: 0px 1em;" src="bilder/chico.jpg">
text texttexttexttexttexttexttexttexttexttexttexttexttexttext
</div>

<!-- -------------- working ---------- -->

<div id="kolumnbox1">
<table>
<tr>
<td> <img style=" border: 2px solid #336699; margin: 0 1em;" src="bilder/max.jpg"></td>
<td>texttexttexttexttexttexttexttexttexttexttexttexttexttexttext
</td>
</tr>
</table>
</div>

graykat

3:20 pm on Jun 13, 2007 (gmt 0)

10+ Year Member



Try this:

#kolumnbox1 {position:absolute; margin: 0px 0px; padding: 2em 1em; border-left: 1px solid #336699; border-right: 1px solid #336699; background: #ffffff; vertical-align:middle;}
#kolumnbox2 {
position:relative;
top:-35px;//negative number aligns bild to middle
left:1px;
float:left;
border: 2px solid #336699;
margin: 0px 1em;
vertical-align:super;
display: block;
}

<div id="kolumnbox1">
<div id="kolumnbox2"><img src="bilder/chico.jpg">

</div>
text texttexttexttexttexttexttexttexttexttexttexttexttexttext</div>

saZmer

7:13 pm on Jun 13, 2007 (gmt 0)

10+ Year Member



I got that working in a separe file, but I couldn't get it working on my site. Tried just about everything. Really weird. On my site the same thing as before occurs.. :/