Hi i use Style Sheets in every site i design, but i have noticed that most of the time my background image never shows up and i end up using an html code. Can someone check my code over for me. If someone can show me another way to write the code and it works every time i will mark as solved. If not... and some one can explain why it does not work everytime i will mark as solved.

background: url(structure_folder/i_background.png) no-repeat;
background-size: 100%;

The problem i might be having is that i always put the background images in a folder called structure_folder.

thanks,

P.S cant beleave im having problems with something so small.

Recommended Answers

All 4 Replies

Hi Steven,

There are a couple of possibilities that could be causing the problem:

  1. I find if I'm not adding values to the background, e.g. no repeat, hex colour, etc. that sometimes I have to use background-image rather than background...but that doesn't look like the problem here.
  2. You may need to use absolute paths rather than relative, see below:
// Relative Path
background: url(structure_folder/i_background.png) no-repeat;
background-size: 100%;

// Absolute Path
background: url(/structure_folder/i_background.png) no-repeat;
background-size: 100%;

It's sounds silly but also make sure you have put this in the body and opened and closed everything correctly {} and used a semi-colon at the end of every line:

body {
background: url(/structure_folder/i_background.png) no-repeat;
background-size: 100%;
}

Not too sure if this solves your issues but hope it helps =D

background: url(structure_folder/i_background.png) no-repeat;
background-size: 100%;

- usually, i put the image path in quotes. Have you tried that yet ? I would try:

background-image: url("structure_folder/i_background.png");
background-repeat: no-repeat;
background-size: 100%;

Hi every one, Can some one please explain / teach me how to use CSS to design a wonder and nice web page / site.
I don't have any understanding for it at all. So can some one help out please.

Thank you

Well, for one the niceness of the design comes from the design itself. CSS merely helps in keeping your html code clean - rather than mixing it with some extra html code for presentation.
The best source to begin with in almost any topic for an explicit intro. is wwwDOTw3schoolsDOTcom/css - Try it, then come back here for problems ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.