Thanks for the couple of replies I've had over this. I have solved the problem by putting the #main div in the normal flow and positioning with margins instead of offsets. (I haven't used floats as one respondent suggested, but even if I had, the problem I now have occurs just the same).
The problem is now that IE is doing something strange to the background image in my H2's. It seems to be truncating 5 pixels from the left-hand side of the image, and tacking it back on to the right-hand side. See http://www.southdevons.co.uk/test.htm (CSS = http://www.southdevons.co.uk/style/test.css) This looks fine with Firefox, but the problem occurs with IE6 I have found a solution by putting a left margin of -5px and a left offset of 5px for H2. But why should I need to do that? and might it have other consequences in other browsers? Another remedy is if I make the H2's block instead of inline, but I can't work out how I would then get the bottom border to be only the length of the text? > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > Barnaby Scott > Sent: 16 November 2005 15:18 > To: css-d@lists.css-discuss.org > Subject: [css-d] Div shrinking to content width in IE > > > This is another question about the following site: > > http://www.southdevons.co.uk/ > CSS is here: http://www.southdevons.co.uk/style/grove.css > > In Firefox, it looks as I intended, but there are a couple > of pages which > have insufficient text to reach the right-hand margin (on > my screen), and on > these pages, IE shows the #main div only as wide as the > existing text. e.g. > http://www.southdevons.co.uk/stats.htm > > I am finding it very frustrating to find a fix for this > (not least because > the phrase I need to search help resources like this list's > archives is > rather hard to express). > > I couldn't see a way of using a width setting, because the > navbar is set to > a pixel width, so I don't know how wide the remainder of a > user's screen is > going to be. I thought that by specifying a left and right > position, the div > would form a box to these points regardless of the amount > of content - > obviously I was wrong. > > I have tried all sorts of other things involving floats and > a container div, > but either these haven't worked, or they have mucked up my > headings. Help! > > Thanks > > Barnaby Scott > > ____________________________________________________________ > __________ > css-discuss [EMAIL PROTECTED] > http://www.css-discuss.org/mailman/listinfo/css-d > List wiki/FAQ -- http://css-discuss.incutio.com/ > Supported by evolt.org -- http://www.evolt.org/help_support_evolt/ ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/