PDA

View Full Version : CSS Background-color help


Shucklak
02-25-2007, 08:19 PM
Hello.
I have a site, http://www.stevenglass.net and I'd like the menu (grey) on the left to continue down to the bottom of the page no matter how much content is in the main body. For instance, on the main page it is not a problem but if you navigate through to the "Side Projects" page at the bottom of the left sidebar it turns white like the main body. Any idea on how I could change that?

Thanks

Excavator
02-26-2007, 02:07 AM
Your universally putting margin: 10px 10px 15px 10px; on almost everything. It's causing the white around your footer.

body
{
margin: 0 0 0 0;
padding: 0 0 0 0;
background-color: #ffffff;
background-image: url("images/background.jpg");
background-repeat: repeat; /*can't say repeatx repeaty*/
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}

Shucklak
02-26-2007, 07:46 AM
Hmm, I just tried that and it didn't seem to change anything.
I'm kind of a CSS "newbie" but I'd like to get good with it so please if you notice some obscure stuff in there be harsh with me.

karinne
02-26-2007, 07:50 AM
2 words: Faux Column (http://alistapart.com/articles/fauxcolumns) :)

Shucklak
02-26-2007, 08:46 AM
Someone else actually told me about that site. It is overwhelming with CSS stuff.
I just can't figure out my own little background problem

karinne
02-26-2007, 09:14 AM
height: 100% is choppy with IE so ... the only way to be certain 100% that it will work in all browsers is to use the faux column method.

All you need to is create the content background in photoshop and apply it to your #wrap. That's it.

Shucklak
02-26-2007, 09:44 AM
wow I'm really sorry, I didn't realize you had the columns page already linked for me..
I tried it and it doesn't seem to be working however. I feel like there is something in my CSS possibly blocking it? I even tried the height: 100%; but that didn't work either.

eTwerp
02-26-2007, 09:56 AM
Hey Shucklak, try using this for your wrap div css.

div#wrap
{
margin: 0 auto 0 auto;
padding: 0 0 0 0;
width: 750px;
background: #ffffff url(images/menuBg.gif);
}


See what that produces.

Hope it helps :)

karinne
02-26-2007, 10:15 AM
I'm a tad bored this monday morning so ... I took your site and fixed it up a bit and added the faux column thing. See the zip file.

Here's the HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="EN-US">

<head>
<title>Steven Glass - Professional Web Engineer - StevenGlass.net</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link rel="stylesheet" href="css/styles.css" type="text/css" media="all" />

</head>

<body>

<div id="header"><h1>Steven Glass - Professional Web Engineer - StevenGlass.net</h1></div>

<div id="main">
<div id="content">
<div class="breadcrumbs">
<ul>
<li><a href="">:: home</a></li>
</ul>
</div>

<h2>Home</h2>

<p>Hello and welcome to StevenGlass.net. Here at StevenGlass.net, you can learn about the techniques that make Web Engineering what it is, and how your company can benefit from its applications. <a href="web_eng.php">Click here</a> to learn what Web Engineering is and how it can help your company or small business.</p>

<p>This site also stands as a personal portfolio for myself, Steven Glass. Please check out my <a href="portfolio.php">portfolio</a> and my <a href="projects.php">side projects</a> so you can get a feel for the type of work I am capable and interested in. If you are interested in my resume, please fill out the form <a href="resume.php">here</a>, otherwise fill out the <a href="contact.php">contact</a> form.</p>

</div>

<div id="menu">

<h3>Menu</h3>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="services.php">Services</a></li>
<li><a href="portfolio.php">Portfolio</a></li>
<li><a href="resume.php">Resume</a></li>
<li><a href="projects.php">Side Projects</a></li>
<li><a href="contact.php">Contact</a></li>
<li><a href="web_eng.php">What is Web Engineering?</a></li>
</ul>

<h3>Members</h3>
<ul>
<li><a href="members">Members Site</a></li>
<li><a href="admin/media">Media</a></li>
<li><a href="admin">Admin</a></li>
</ul>

</div>
</div>

<div id="footer">&copy; Copyright 2007 - Stevenglass.net - All Rights Reserved</div>

</body>
</html>

The CSS
* {
margin: 0;
padding: 0;
}

html {
background: #000 url(../i/background.jpg) repeat 0 0;
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
color: #000;
}

body {
margin: 0 auto;
width: 750px;
}

/* ------------------- common elements ---------------------- */

img {
border: 0;
display: block;
}

p, h2, h3 {
margin: 10px 10px 15px;
}

a:link, a:visited, a:active {
text-decoration:none;
color:#5757ff;
}

a:hover {
text-decoration:none;
color:#757575;
}

/* ------------------- main separations ---------------------- */

#header {
background: #fff url(../i/background-header.jpg) no-repeat 0 0;
width: 750px;
height: 165px;
}

#main {
background: #fff url(../i/background-main.jpg) repeat-y 0 0;
overflow: auto;
width: 750px;
}

#content {
width: 550px;
float: right;
}

#menu {
width: 200px;
float: left;
}

#footer {
width: 730px;
background-color: #e5e5e5;
padding: 10px;
text-align: center;
}

/* ------------------- header: styling ------------------------ */

#header h1 {
display: none;
}

/* ------------------- content: styling ----------------------- */

.breadcrumbs {
background-color: #dddddc;
}

.breadcrumbs ul {
list-style: none;
padding: 5px;
}

.breadcrumbs ul li {
display: inline;
margin: 0 3em 0 0;
}


/* ------------------- menu: styling -------------------------- */

#menu ul {
list-style: none;
}

#menu ul li {
border-bottom: 1px solid #B5B5B5;
}

#menu ul li a {
display: block;
padding: 7px 7px 7px 9px;
color: #252525;
text-decoration: none;
}

#menu ul li a:hover {
background-color: #252525;
color: #B5B5B5;
}


And the 3 images that I used
8159 8160 8161

Shucklak
02-26-2007, 11:16 AM
@eTwerp
That's actually how I originally had it, well similar. However in the case where the main body is actually shorter than the menu it makes the bottom of the main body grey, which is the reason why I changed it in the first place. (I think that makes sense)

@karinne
I can't believe you went through all that. Thanks so much. It's going to take me some time to incorporate because the actual page in mostly in php, but I'm sure I can get it now! Thanks a bunch.

karinne
02-26-2007, 11:21 AM
No problem ... it was killing me to see you struggle for, what I find anyway, such a simple thing :lol:

Let me know how it goes and if you need some explanation for anything. It's fine that I re-did the whole thing but you need to understand what I did ;)

eTwerp
02-26-2007, 11:21 AM
Well if you change it to this

div#wrap
{
margin: 0 auto 0 auto;
padding: 0 0 0 0;
width: 750px;
background: #ffffff url(images/menuBg.gif) repeat-y;
}


it should work nicely. Well, hopefully :P

But I'd use karinne's code, it's undoubtedly good :)