SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist ktown's Avatar
    Join Date
    May 2001
    Location
    toronto
    Posts
    478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    removing margins in Opera browser

    hi all.

    someone told me once that to remove margins in the opera browser you have to place


    <style>
    body {
    margin: 0px 0px 0px 0px;
    }
    </style>


    i've placed that code into the head of my document but its still not working... any ideas? is it the right code?

  2. #2
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's one bit missing, but it wouldn't actually cause the margin to not be set.
    Add type="text/css" to the opening <style> tag.

    So, it's...

    <style type="text/css">
    body {
    margin: 0px;
    }
    </style>


    As I said, that alone won't cause the margin not to be set (I just tested it in both IE5.1 and Opera5 (both Mac))

    Can you post everything between (and including) the <head>...</head> tags?
    Perhaps then we'll be able to spot whatever else it is that's causing the problem.
    Last edited by Bill Posters; May 27, 2002 at 07:53.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  3. #3
    SitePoint Zealot 19nine78's Avatar
    Join Date
    Feb 2002
    Location
    Ayr, scotland
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    opera (on PC anyway) uses padding, not margins so change your css to:

    <style type="text/css">
    body {
    margin: 0;
    padding:0;
    }
    </style>

    and it should work in all browsers.

    cheers

    alastair

  4. #4
    SitePoint Evangelist ktown's Avatar
    Join Date
    May 2001
    Location
    toronto
    Posts
    478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you both

    Bill was right, his code works in Opera.

  5. #5
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    opera (on PC anyway) uses padding, not margins ...
    Opera refer to that as a "difference of style".

    I'd call it non-compliance.

    The Margin attribute functions as standards dictate in Mac Opera.

    How does it command such great respect for CSS compliance when it goes AWOL on such a fundamental attribute?


    Addendum
    ----------------

    OK, now I'm confused.

    Opera claims that it is they and not IE and Netscape who are using standards correctly.
    Yet on W3C it is stated that we use the margin attribute (and not padding) to set the 'page margin' (i.e. space around the inside-edge of the browser window).

    So, what's the standard?

    Surely W3C wouldn't recommend non-standard methods on their site, so I'm left assuming that the folks at Opera are just talking bs.

    Yes? No?
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  6. #6
    SitePoint Zealot 19nine78's Avatar
    Join Date
    Feb 2002
    Location
    Ayr, scotland
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm confused too, this 'quirk' has annoyed me for some time. The closest I could come to finding some justification for this was here Appendix A - CSS2 spec

    Which shows a body tag defined with an 8px padding (about a third of the way down). Which suggests that the w3c are contradicting themselves or it one of these 'the user agent is free to make it own mind up so screw you' types, simialar to the way mozilla uses padding to set indents on <ul>'s whereas IE (and opera) use margins.

    frustrated

    alastair

  7. #7
    SitePoint Guru
    Join Date
    Jul 2000
    Location
    Long Island, NY
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cripes and nastier stuff! I just left a whole site with the rightmargin, leftmargin, marginwidth, etc. in the body tag, thereby dooming the site to non-compliance because the CSS margins attributes didn't work in Opera! I never really liked it much but now I'm beginning to feel actual hostility.

  8. #8
    SitePoint Evangelist ktown's Avatar
    Join Date
    May 2001
    Location
    toronto
    Posts
    478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops...

    19nine78 sorry bud... it was your code that did the trick.. so sorry.

    ~nina


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •