Forum Moderators: open

Message Too Old, No Replies

Images + text inside Divs (Moz/IE differences)

         

SethCall

8:35 pm on Oct 3, 2002 (gmt 0)

10+ Year Member



Alright guys: here is the format of my div

IMAGE
(60% of div-height)

line of text
line of text
line of text

Ok heres the deal: my image is position:relative, right? and its height is 60% of the div. In IE, the div, which is sized in Pixels, resizes to fit the image inside of it (width-wise). In mozilla, the div does not resize. Now, I suppose someone is in the wrong here (*probably IE*)

OK another issue: my lines of text actually are too big for the div, so again, IE resizes, but Mozilla just keeps the div the same, and the text overflows.

So whats a good solution?

SethCall

10:03 pm on Oct 3, 2002 (gmt 0)

10+ Year Member



OK: well i *thought* that width's and heights for divs were a "suggestion", and they would expand if the data needs to.

but I can see that i was wrong. (*after all, why is their an overflow paramter?*)

Well, so I just dont set any size for the div, and let the image decide how big I want the div to be. This works for me just fine.

Though I dont have quite as much control as I would like...

tedster

3:07 am on Oct 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, so I just dont set any size for the div, and let the image decide how big I want the div to be. This works for me just fine.

That's probably the simplest answer. The next shot would be declaring a value for overflow (auto?) That offers you more control, but you'd need to understand the reasons for the overflow so you set it wisely.

SethCall

4:26 am on Oct 4, 2002 (gmt 0)

10+ Year Member



well: overflow auto adds scrollbars if anything overflows, which to me.. sucks ;) i hate scroll bars all over my webpage.

Whaddya think stylistically?

ANother issue: when I first came to this forum, I was indoctrinated with the idea of div within a div for borders and such.

Well, heres a problem:
Say you want a border around an image, and you put it inside a div. Well.... In Mozilla, its just going to overflow, and look bad, and since an image overflows its containing div with a border, I can see no way to fix this other than setting its left:(1 pixel to right of div) and its width to 2 pixels smaller than the div,(for a 1px border) and this means No percentages ;(

Sigh.
Can you think of any workarounds? that are somewhat elegant? Or just forget borders around the image. Ok this is only a problem if you want the image to be as big as the containing div (which I do)
And sadly, a div wont resize in mozilla due to text inside of it, but IE will...

tedster

6:31 am on Oct 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's only a problem if you want to "fix" the dimensions of the div, right? Isn't the best thing just to let it flow and be liquid with the content?

SethCall

6:53 am on Oct 4, 2002 (gmt 0)

10+ Year Member



Your right! for some reason, I thought that I was using a div without widths and heights. Sorry about that.