Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: margin css-code

  1. #1
    New Coder
    Join Date
    Aug 2003
    Location
    vancouver,WA
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    margin css-code

    I have tried some margin commands to correct this.Now i am at a total loss on how to do it.

    I want the header on top to stretch all the way across,leaving rest of page white.

    if anyone can help

    thank you

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <div style="margin-left: 0px; margin-right: 0px;; width: 100%; height: 15%; border:0; background: #deb887;"><!--HEADER-->
    <CENTER><h3>THIS IS A HEADER FOR NEW SITE</h3></CENTER>
    </div>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This work in Netscape 7 and IE 5.1.7 on my MAC.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled</title>
    <style type="text/css">
    html>body{
    width: 100%
    }
    </style>
    </head>
    <body style="margin: 0px; padding: 0px">
    <div style="position: absolute; margin-left: 0px; margin-right: 0px;; width: 100%; height: 15%; border:0; background: #deb887;"><!--HEADER-->
    <CENTER><h3>THIS IS A HEADER FOR NEW SITE</h3></CENTER>
    </div>
    </body>
    </html>

    MNS
    [size=1]"If you want to be "in the biz" you are going to have to roll with the changes or get out, basically."

  • #3
    giz
    giz is offline
    Regular Coder
    Join Date
    Apr 2003
    Location
    UK
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The four margin errors can be replaced with a little bit of CSS code instead. Put this is a text file, with a name ending in .css:

    body {
    margin: 0px;
    padding: 0px;
    }





    You should export the CSS to an external file and call it with instructions in the <head> section of the HTML file. Most people use this one, but it can cause problems:

    <link type="text/css" rel="stylesheet" src="/path/file.css">

    It is better to use this slightly longer version of this, again placed in the <head> section of the HTML file:

    <meta http-equiv="Content-Style-Type" content="text/css">

    <style type="text/css">
    @import url(path/file.css);
    </style>


    This version hides the CSS from older versions of Netscape that cannot handle CSS. This stops those versions from displaying a corrupted page with overlapping elements.

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by giz
    The four margin errors can be replaced with a little bit of CSS code instead. Put this is a text file, with a name ending in .css:

    body {
    margin: 0px;
    padding: 0px;
    }





    You should export the CSS to an external file and call it with instructions in the <head> section of the HTML file. Most people use this one, but it can cause problems:

    <link type="text/css" rel="stylesheet" src="/path/file.css">

    It is better to use this slightly longer version of this, again placed in the <head> section of the HTML file:

    <meta http-equiv="Content-Style-Type" content="text/css">

    <style type="text/css">
    @import url(path/file.css);
    </style>


    This version hides the CSS from older versions of Netscape that cannot handle CSS. This stops those versions from displaying a corrupted page with overlapping elements.
    Putting that little snippet in alone will not do it. Try it out and see. What I posted above works. It needs the html>body width 100% to work.
    [size=1]"If you want to be "in the biz" you are going to have to roll with the changes or get out, basically."


  •  

    Posting Permissions

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