Solved

Website Background CSS

Posted on 2012-03-24
8
225 Views
Last Modified: 2012-03-25
Hey Experts I have a hopefully pretty easy one for ya.

I have attached my super simple site. So far I can't get the body to show the background in the images folder. It won't show up. I eventually want it to just repeat down the page and float in the center of the page on the x-axis.

First step is getting it to show up. Please tell me what I am missing!

-Jeff
Basic-Site.zip
0
Comment
Question by:jeffiepoo
  • 6
  • 2
8 Comments
 
LVL 16

Assisted Solution

by:s8web
s8web earned 500 total points
ID: 37762627
Removing the comma before repeat-y should do it.
0
 
LVL 16

Accepted Solution

by:
s8web earned 500 total points
ID: 37762630
On second look, the path is wrong too.

With the current structure, make it look like this:

body {
  background: url(../images/Background.jpg) repeat-y;
  width: 800px;
  height: 800px;
}

Also, setting a width and height on the body like that is unusual and probably not what you want to do.
0
 
LVL 16

Expert Comment

by:s8web
ID: 37762637
In a css file, the location of the dependent files are relative to the css file, not the page.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 16

Assisted Solution

by:s8web
s8web earned 500 total points
ID: 37762639
If you take your background image and crop it down so that it is 1px high, you will achieve the same look without the seam. The file will also be smaller.

I don't know if this page is intended for the public, but if it is, anyone with a display smaller than 1680x1050 isn't going to see the right side of your background.
0
 
LVL 6

Author Comment

by:jeffiepoo
ID: 37763075
Now what is wrong? I made the suggested changes.
Basic-Site.zip
0
 
LVL 16

Assisted Solution

by:s8web
s8web earned 500 total points
ID: 37763134
Not much really. You have a good start. You will need to put the background on the body. The rest of the adjustments are to center everything appropriately.

/* reset browser styles */
html, body, h1, h2, h3, h4, h5, h6, p, ol, ul, li, pre, code, address, variable, form, fieldset, blockquote {
 padding: 0;
 margin: 0;
 font-size: 100%;
 font-weight: normal;
}
ol { 
  margin-left: 1.4em; 
  list-style: decimal; 
}
ul { 
  margin-left: 1.4em; 
  list-style:square; 
}
img {
  border: 0;
}
/* end reset browser styles */
body{
	background: url(../images/Background.jpg) top center repeat-y;
	text-align:center;
	}
#main {
  width: 950px;
  margin: 0 auto;
  text-align:left;
}

Open in new window

0
 
LVL 6

Author Comment

by:jeffiepoo
ID: 37763260
Why did the background not work inside of the div tag?
0
 
LVL 16

Assisted Solution

by:s8web
s8web earned 500 total points
ID: 37763570
Well, actually it did. The reason you didn't see the background is because there was no content in the div. At that point the div was collapsed and not taking up any space. If you were to put the background image on that div, the background would not be displayed past the end of the content. By putting it on the body, it extends the entire height of the page regardless of content.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question