|
Posted by James A on 05/11/07 16:56
"Gιrard Talbot" <newsblahgroup@gtalbot.org> wrote in message
news:134544kbnt7d1f8@corp.supernews.com...
> James A a ιcrit :
>> Hi,
>>
>> I'm trying to create a 10px wide margin on the left and right of a page
>> using CSS. Those margins need to be 10px whatever the width of the page.
>> Firefox and Opera work fine, but in IE6 the right hand side has no margin
>> and a horizontal scroll bar appears as the page is a little wider than
>> the window (10px maybe). My test page is here:
>> http://www.felston.com/temp/test.html
<snip>
>> --
>> James
>
> Why do you first remove the default margin of the body, then create an
> unneeded, non-necessary DOM node duplicating the function of the body and
> then set some absolute positions that exactly equate and act like margins
> on the body? All of what you are trying to do could be done by simply
> redefining the default margins on the body, and that, without a wrapper
> div and without absolute positioning.
>
> <style type="text/css">
> body
> {
> margin: 0px 10px;
> padding: 0;
> background-color: #CCC;
> height: 600px;
> }
> </style>
> </head>
>
> <body>
> ... content ...
> </body>
> </html>
>
> Gιrard
> --
> Using Web Standards in your Web Pages (Updated Dec. 2006)
> http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pages
Hi Gιrard,
I copied the code you've supplied to this test page:
http://www.felston.com/temp/test2.html
and it produces a background colour of grey (#CCC) that extends to the
corners of the screen with no 10px margin. That's not what I was after in
fact. I know I did not specify that requirement in my original text, sorry.
The code with the wrapper as suggested by BootNic is doing what I want as
shown here http://www.felston.com/temp/test.html If that can be achieved
without the extra wrapper div then I would be very happy to implement it
that way, thanks.
--
James
[Back to original message]
|