Forum Moderators: not2easy

Message Too Old, No Replies

Div does not resize

When Image exceeds the page width

         

limbo

3:33 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi.

There are a few pages on a site of mine where the divs that contain the header and footer do not resize to fill the page (liquid) where an image exceeds the width of the browser window. (I cannot change the image size!)

I am using IE 5.5 like all the other poor souls within our organisation.



SNIPPET:

<html>
<head>
<style type="text/css">
#mainlinks {
font-family: Arial, Helvetica, sans-serif;
font size: 0.8em;
color: #ffffff;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 15px;
background-color: #cc0000;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
#footer {
font: 0.7em Arial, Helvetica, sans-serif;
color: #000000;
background-color: #e8e8e8;
padding-top: 10px;
padding-right: 5px;
padding-bottom: 10px;
padding-left: 15px;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
margin-bottom: 35px;
margin-top: 20px;
margin-bottom: 35px;
}
</style>
</head>

<body leftmargin="0" topmargin="0">

<div id="mainlinks">
<a href="index.htm">Home</a> ¦
<a href="whatsnew.htm">What's New</a>
etc etc
</div>

<img src="case.gif" width="2000" height="300">

<div id="footer">
<a href="index.htm">Home</a> ¦
<a href="whatsnew.htm">What's New</a>
etc etc
</div> </body></html>


I have tried adding the width: 100% property to no avail. Hope I have included enough info for this problem to make sense. Probably something really simple :)

Ta

Limbo

P.S.The CSS is in long hand so that 'anyone' can update it.

<edit> Altered to make Viewing Easier</edit>

photon

4:10 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think that the 100% width refers to the viewport, not to the page size, so it's working the way it should.

Not sure how to "break" it to work the way you want though. Maybe enclosing the entire page in a containing div with a width of 2000px?

[edited by: photon at 4:17 pm (utc) on May 20, 2004]

yowza

4:14 pm on May 20, 2004 (gmt 0)

10+ Year Member



I'm not sure, but have you tried width: auto ?

limbo

4:57 pm on May 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe enclosing the entire page in a containing div with a width of 2000px?

Can't do it - the page is linked to DW templates :(

width: auto

nice try but that didn't work.

Ta

Limbo

Smad

9:44 am on May 21, 2004 (gmt 0)

10+ Year Member



Think you might need to put all elements into a container which is 100% wide, then when that is stretched the footer and header which are set to 100% should stretch too..might be worth trying the body, html tag first at width 100% as then the rest have a guide.

Still learning so if i am wrong i apologise :)

limbo

12:41 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep

that worked -

Used one 'wrapper' div for the body of DW templates with the offending images.

Set the width to 100% and fixed the bug :) (photon your suggestion was the same principle but using the fixed width)

Thanks all

Limbo