When I specify "height" in the style for any element, IE makes the whole thing 100% width , Instead of placing it "autosized" for width.
Other browsers display it properly, but not IE How do I fix it?
& lt; Div style = "position: full; top: 50px; left: 50px; background: green;" & Gt; & Lt; Div & gt; & Lt; Div & gt; Trial & lt; / Div & gt; & Lt; Div style = "height: 20px;" & Gt; Why it makes 100% width in IE & lt ;? / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;
Thanks!
Here's something that can work for you. It's a little hack, but if you have some text Other than Javascript, this is the only way I know. We are basically compelling the width by not allowing the line to break. If you need a line break then you & lt; Br / & gt;
s.
& lt; Div style = "position: absolute; top: 50px; left: 50px; background: green; width: 0px" & gt; & Lt; Div & gt; & Lt; Div & gt; Trial & lt; / Div & gt; & Lt; Div style = "height: 50px; white-space: aboper" & gt; This is usually the size in IE 6 & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;
On the second thought, do not check the link. It is outdated and does not work as advertising.
Old answer:
I believe non-absolutely designed DIVs automatically extend their container horizontally to fill . Since you have not specified a container size for this device, it spreads to fill the whole page.
I find it weird that Firefox did not extend the div ... I'm not sure who among them is "right".
Comments
Post a Comment