Solved

Website Background CSS

Posted on 2012-03-24
8
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

734 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