Re: Removing margins with CSS

Sorry for not mentioning browser version. Actually it's not NS4, it NS
6.2.

>>> Alexander Savenkov <w3@hotbox.ru> 04/19/02 09:50pm >>>
Hello again,

> Please could someone tell me the correct way to remove the margin
from
> a page using CSS.

> I am currently using;
> BODY    {margin: 0 px;}
> which works for IE but not NS.

> P.S. I have also tried {padding: 0 px;}

  Although Nigel haven't mentioned his Netscape version I assume it is
  version 4.x, the buggiest piece of code on Earth.

  Anyway if you want to have a clean CSS solution without NS-specific
  tag attributes you may need the following (sorry for the copyright -
  I was very happy when that finally worked in NS4):

  /* nav4 margin hack (C) Alexander Savenkov mailto:w3@hotbox.ru */
  html, body { margin: 0px } /* what I wanted it to be */
  body { margin: -10px }     /* what I have to do to remove the
uglyness /*
  @media screen {            /* NS4 can't see inside @media rules */
  body { margin: 0px } }     /* but the clever UAs are aware of them
*/
  /* nav4 margin hack end */

  This won't completely remove the margins but will result in some
  interesting effects which are helpful in most cases.

  I used this solution at http://idefence.da.ru/. There are margins
  around the page in my NS4, but the absolute positioned elements are
  at their appropriate places. The absolute position is calculated
  relatively to the page contents (like if there were no margins).
  Internet Explorer obviously displays the page correctly. So does
  Opera.

  Another opportunity to remove the margins is:
     html, body { margin: 0px; position: absolute; top: 0px; left: 0px
}

  or even
     html, body { margin: 0px; position: absolute; top: 0px; left:
     0px; bottom: 0px; right: 0px }

  I had no chance to test this on my Netscape 4 because it immediately
  died with "The program performed illegal operation..." I only know
  that this may result in some problems with scripts.

  Hope this helps.

Best regards.
---
  Alexander "Croll" Savenkov         http://www.thecroll.com/ 
  w3@hotbox.ru                            http://croll.da.ru/ 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.

Received on Monday, 22 April 2002 03:58:05 UTC