Opera browser.

This is a discussion on Opera browser. within the Tech Board forums, part of the Community Boards category; I've been working on a website for a friend using W3C strict html and css. I've noticed that despite specifying ...

  1. #1
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831

    Opera browser.

    I've been working on a website for a friend using W3C strict html and css. I've noticed that despite specifying 0px margins to the <body> element in the style sheet, Opera 7 insists on placing a margin around the page. If I specify negative margins, I can get rid of it. IE, Firefox etc., do not exhibit this feature.

    To Opera fans, is this a feature of Opera, or is there something I need to know about it?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I just tried it with the following:
    Code:
    <html>
    <head>
    <title></title>
    <style type="text/css">
    body { 
      margin: 0px 0px 0 px 0px;
      border: 3px solid black;
    }
    </style>
    </head>
    <body>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    &nbsp;<br/>
    </body>
    I see what you are talking about on the left edge. But that is because there is a menu there that can be collapsed. If you click on the bar it'll expand that menu. The top and right edges lined up with the nav bar and scroll bar.

    You mind posting a pic and the css?

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I've made a noddy pair that show what I mean. This html...
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1">
    <link REL=StyleSheet HREF="prv.css" TYPE="text/css">
    </head>
    
    <body>
    <table class="top">
        <tr>
        <td>Test</td>
        </tr>
    </table>
    </body>
    </html>
    ... with this stylesheet...
    Code:
    body {background-color: #ffff00;
          margin-top: 0;
          margin-bottom: 0;
          margin-left: 0;
          margin-right: 0}
    
    table.top {color: #ff0000;
               margin-top: 0;
               margin-bottom: 0;
               margin-left: 0;
               margin-right: 0;
               border-color: #00ffff;
               border-width: 8px;
               border-style: solid;
               width: 700px;
               height: 50px}
    ... gives this with IE and FireFox, and this with Opera 7. Note with Opera, there is a yellow border above and to the left of the cyan table frame. If you edit the style sheet to use -8px for margin-top and margin-left for the body element, Opera looks right, but IE and FireFox now look wrong.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Its putting a padding in. Add:
    Code:
    padding: 0 0 0 0;
    in the body spec.

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Right, thanks, that gets rid of it, but the W3C standard for padding is zero, so Opera must be setting it to 8 - that is still an issue surely?

    I think it is academic anyway, as my customer would probably never notice - it's just that I did.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    Damn... you all need to learn shorthand CSS:

    Code:
    body {
       margin: 0px;
       padding: 0px;
    }
    I do that with all of my CSS files and it has worked flawlessly on all my pages. And Adrian, I've also had IE and Firefox show padding if it is not set to zero.

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Yeah I know you can do that ober, i just prefer stating them all.

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    ober, with 0 you can leave out the unit:
    Code:
    html, body {
      margin: 0;
      padding: 0;
    }
    Matter of taste, of course, but I find units annoying when I know I'll never put anything but 0 there.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. new Opera mini - web browser for any java enabled mobile
    By xErath in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-29-2006, 03:23 PM
  2. My experience with FF and why Opera is better
    By ober in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 03-15-2005, 12:38 PM
  3. Getting Default Browser and Running It
    By Driver in forum Windows Programming
    Replies: 4
    Last Post: 10-22-2004, 02:08 PM
  4. Opera Web Browser
    By MrWizard in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 06-17-2002, 04:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21