...

View Full Version : CSS and Borders



...{chris}...
06-03-2005, 03:15 PM
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...



<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...



<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

mark87
06-03-2005, 03:39 PM
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;

ronaldb66
06-03-2005, 03:56 PM
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.


Okay, this may sound silly, but always leave a space after every colon in a property-value pair, so:
border-color:_#000000; and not:
border-color:#000000;

I edited in the spaces, removed a couple of unnecessary repeated declarations and short-handed the border declarations to this:

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.

...{chris}...
06-03-2005, 04:56 PM
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


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...


body{
width:760px;
border-style:solid;
border-color:#000000;
}

Ill check that out.

_Aerospace_Eng_
06-03-2005, 05:40 PM
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.


Okay, this may sound silly, but always leave a space after every colon in a property-value pair, so:
border-color:_#000000; and not:
border-color:#000000;

I edited in the spaces, removed a couple of unnecessary repeated declarations and short-handed the border declarations to this:

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.

...{chris}...
06-03-2005, 10:26 PM
So its just the first letter/numeral of the hex? Thanks.

_chris



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum