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 6 of 6

Thread: CSS and Borders

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Yucaipa, California
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS and Borders

    Im trying to recreate a a personal website I did in class at the beginning of the year. We must now create the site using all the html/flash/graphics work that we learned. Even though we havent done CSS, I'd like to be different from the mass of animals and use it now. Im having trouble with the "#main" area of the code... I need two black lines, 1 on top, and 1 on bottom of that section. They arent showing up, but the "#footer" ones work just fine. Heres my CSS...

    Code:
    <style type="text/css">
    #main {
    background-image:url(main-background.jpg);
    height:250px;
    width:760px;
    border-color:#000000;
    border-top-width:5px;
    border-bottom-width:5px;
    border-left-width:0px;
    border-right-width:0px;
    font:arial;
    font-variant:small-caps;
    font-size:11px;
    color:#000000;
    text-align:justify;
    width:760px;
    }
    #footer{
    background-image:url(footer-background.jpg);
    width:720px;
    height:200px;
    border-style:solid;
    border-color:#FFFFFF;
    border-top-width:10px;
    border-bottom-width:10px;
    border-right-width:20px;
    border-left-width:20px;
    font:arial;
    font-variant:small-caps;
    font-size:11px;
    color:#000000;
    text-align:justify;
    }
    </style>
    And heres my HTML...

    Code:
    <html>
    <head>
    <title>Personal Website</title>
    </head>
    
    <body bgcolor="#999999">
    <center>
    <div id="main">
    This is another test.
    <p>
    Test
    </p>
    </div>
    <div id="footer">
      Hello, this is a test
      <p>test</p>
      </div>
    </center>
    </body>
    </html>
    Any help would be greatly appriciated. Thanks .

    _chris

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Replace -

    border-color:#000000;
    border-top-width:5px;
    border-bottom-width:5px;
    border-left-width:0px;
    border-right-width:0px;

    With -

    border-top: 5px solid #000;
    border-bottom: 5px solid #000;

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Background image?

    What does the background image look like? I can't really see a reason why your borders wouldn't show up...

    On another note: I would advise to use the CSS background-color property to set the page's background color instead of the bgcolor attribute; also, the center element could be replaced by auto left and right margins on both the main and the footer div.

    Edit:
    Okay, this may sound silly, but always leave a space after every colon in a property-value pair, so:
    Code:
    border-color:_#000000;
    and not:
    Code:
    border-color:#000000;
    I edited in the spaces, removed a couple of unnecessary repeated declarations and short-handed the border declarations to this:
    Code:
    html {
    font-size: 76%;
    background-color: #999;
    }
    
    body {
    font-size: 1em;
    color: #000000;
    min-width: 600px;
    font-family: arial, sans-serif;
    }
    
    /* centering the divs */
    #main, #footer {
    margin: 0 auto;
    }
    
    #main {
    background-image: url(main-background.jpg);
    height: 250px;
    width: 760px;
    border: solid #000;
    border-width: 5px 0;
    font-variant: small-caps;
    text-align: justify;
    }
    
    #footer{
    background-image: url(footer-background.jpg);
    width: 720px;
    height: 200px;
    border: solid #FFFFFF;
    border-width: 10px 20px;
    font-variant: small-caps;
    text-align: justify;
    }
    See if it works for you.
    Last edited by ronaldb66; 06-03-2005 at 03:12 PM.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #4
    Registered User
    Join Date
    Mar 2005
    Location
    Yucaipa, California
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks guy, it was just what I needed. I just notice that I never declared what type of border (border-style:solid. I dont understand how the 3 hexadecimal sytem works, never used it, never learned it, perhaps I should. Sorry about the messy code, its the first CSS I'm doing. Much thanks

    _chris

    Edit:
    I was only using a colored background in the HTML part to tell the difference from the white border on the "#footer" area. There will be a table to place it all in, unless I can do something like...
    Code:
    body{
    width:760px;
    border-style:solid;
    border-color:#000000;
    }
    Ill check that out.
    Last edited by ...{chris}...; 06-03-2005 at 03:59 PM.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by ronaldb66
    What does the background image look like? I can't really see a reason why your borders wouldn't show up...

    On another note: I would advise to use the CSS background-color property to set the page's background color instead of the bgcolor attribute; also, the center element could be replaced by auto left and right margins on both the main and the footer div.

    Edit:
    Okay, this may sound silly, but always leave a space after every colon in a property-value pair, so:
    Code:
    border-color:_#000000;
    and not:
    Code:
    border-color:#000000;
    I edited in the spaces, removed a couple of unnecessary repeated declarations and short-handed the border declarations to this:
    Code:
    html {
    font-size: 76%;
    background-color: #999;
    }
    
    body {
    font-size: 1em;
    color: #000000;
    min-width: 600px;
    font-family: arial, sans-serif;
    }
    
    /* centering the divs */
    #main, #footer {
    margin: 0 auto;
    }
    
    #main {
    background-image: url(main-background.jpg);
    height: 250px;
    width: 760px;
    border: solid #000;
    border-width: 5px 0;
    font-variant: small-caps;
    text-align: justify;
    }
    
    #footer{
    background-image: url(footer-background.jpg);
    width: 720px;
    height: 200px;
    border: solid #FFFFFF;
    border-width: 10px 20px;
    font-variant: small-caps;
    text-align: justify;
    }
    See if it works for you.
    You don't need to have a space after the colon, it will work either way. The way shorthand hex works was lets say if it was #000099; the shorthand would be #009 or if it was #990000 it would be #900 or for #CCCCCC you could use #CCC it works when you have pairs in the hex values.

  • #6
    Registered User
    Join Date
    Mar 2005
    Location
    Yucaipa, California
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So its just the first letter/numeral of the hex? Thanks.

    _chris


  •  

    Posting Permissions

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