Solved

Website Background CSS

Posted on 2012-03-24
8
222 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
Comment Utility
Removing the comma before repeat-y should do it.
0
 
LVL 16

Accepted Solution

by:
s8web earned 500 total points
Comment Utility
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
Comment Utility
In a css file, the location of the dependent files are relative to the css file, not the page.
0
 
LVL 16

Assisted Solution

by:s8web
s8web earned 500 total points
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 6

Author Comment

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

Assisted Solution

by:s8web
s8web earned 500 total points
Comment Utility
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
Comment Utility
Why did the background not work inside of the div tag?
0
 
LVL 16

Assisted Solution

by:s8web
s8web earned 500 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Read about why website design really matters in today's demanding market.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now