Background image

Permalink 1 user found helpful
I'm trying to add a background repeat 4x4 pixel to plainyogurt, and plainyogurt900.

body { /* customize_background */ background-color: #ffffff; /* customize_background */  background-image: url(images/bg_stripe.png) top left; padding: 0px; margin: 0px; }


I've tried a million things, but nothing seems to get the background image to take. What's wrong with the above? (I added "background-image...top left;)

 
c5studio replied on at Permalink Reply
c5studio
You can only use the top left position property if you use just the "background" property. It will not work with the "background-image". But you don't need that anyways, and the background will repeat horizontally and vertically by default.

So try getting rid of the "top left" property.
duxferrarie replied on at Permalink Reply
Thanks. No dice. I've tried:
background-image: url(blah);
background: url(blah);
background: url(blah) top left;

Nada. I've don't get what could be overriding main.css.

???
c5studio replied on at Permalink Reply
c5studio
Is the background image showing up at all, or is it just not repeating?
duxferrarie replied on at Permalink Reply
Not showing up at all.
Tony replied on at Permalink Reply
Tony
maybe you image path is wrong? (remember that it should be a path relative to the CSS file) or maybe you need to add !important to that CSS rule incase it's getting overridden by another rule. try pulling all those /* customize_ */ comments out of there too.
duxferrarie replied on at Permalink Reply
!important solves it.

body { background: #fff9d9 url(images/bg_stripe.png)!important; padding: 0px; margin: 0px; }


Just out of curiosity, what am I overriding with !important?
duxferrarie replied on at Permalink Reply
Forgot to say thanks. Thanks!
Tony replied on at Permalink Reply
Tony
not sure what the !important overrides, buthttp://getfirebug.com would be able to tell you.
bishopdennis replied on at Permalink Reply
bishopdennis
this is great ... but where does one put the code? Obviously, everyone seems to have found where to edit this body code ... can you help someone who hasn't got a clue?

Thanks.

UPDATE: I found it. I've only been working at this for a few days. Hey ... I'm graduating from FrontPage 2003. I appreciate everyone who has been so kind to answer my "silly" (to the experienced) questions.
rickhboone replied on at Permalink Reply
rickhboone
The last message gave me hope-I am still inexperienced. Where do you paste this code?
12345j replied on at Permalink Reply
12345j
after copying plain yogurt from root/concrete/themes to root/themes copy it into main.css
rritz replied on at Permalink Reply
rritz
I just wanted to tell everyone who is on the verge of dispair like I was: After trying to add the pic for several times, finally it worked for me though I did not make any changes in the code.
Adding the attribute "fixed" to the image
made the page go all white for several times, but in the end, with the tenth try, it worked - but don´t ask me why.
rritz replied on at Permalink Reply
rritz
well, after logging out of admin and clearing the cache the background image has disappeared again ... :-(

I dont get it,´sometimes the concrete output is totally random.

just tell me what happened someone
zoinks replied on at Permalink Reply
It's the strangest thing which I can not comprehend at all...

When I had a one-piece template (ie. no header and footer includes in a separate 'elements' directory), my background images worked perfectly with this CSS code:

.ccm-next-previous-wrapper .ccm-next-previous-previouslink a    { background:url(images/previous-arrows.gif) 0 0 no-repeat; display:block; width:30px; height:30px; }
.ccm-next-previous-wrapper .ccm-next-previous-nextlink a      { background:url(images/next-arrows.gif) 0 0 no-repeat; display:block; width:30px; height:30px; }


This code, incidentally, follows the exact format of the default Green Salad theme that comes pre-installed with C5.

Once, I split the header and footer up and stuck them in an 'elements' directory, these background images broke.

Peculiar.

...We ARE allowed to style blocks (like the Previous and Next block) right within our main.css stylesheet, aren't we? This is what I did in the code above and, prior to splitting the template into header and footer includes, it worked fine. Once I split up the template, these background-images broke.

I got the background images back (sort of*) if I added single quotes around the background image code like this...

background:url('images/previous-arrows.gif')

rather than this:

background:url(images/previous-arrows.gif)

*The reason I say "sort of" is because I could get one to show up, but not the other. Either the Previous button would show the background image OR the Next button, but not both. That is something I found very odd.

But, single quotes shouldn't be necessary around Background-Image url() references, anyway. The Green Salad theme doesn't have them and other areas of my template (such as the top logo graphic) is loading background images fine without single quotes.

So this problem APPEARS to have something to do with styling a block within the main.css, I think. But, why shouldn't I be able to do this? I can if my template is not split up into header and footer includes.

***
I would like to point out that my header and footer were EXACTLY like the Green Salad header and footer. No more, no less. If you take a look at the Green Salad theme, you'll see that these header and footer includes are pretty useless, actually, because there is actually no really important reusable code in them. Generally, a header and footer have some menus in them or some very often reused content that would suck if you had to update them on every page, but these includes don't have anything like that. The header just links the stylesheets and calls the header element <?php Loader::element('footer_required'); ?>
and the footer just calls the footer element <?php Loader::element('footer_required'); ?>
***

One more weird thing...
This is the proper way to link a stylesheet:
<link rel="stylesheet" media="screen" type="text/css" href="<?php  echo $this->getStyleSheet('style.css')?>" />


This is not the proper way, but I posted about this on the forum and some people said it was fine to do it this way:
<link href="<?=$this->getThemePath()?>/style.css" rel="stylesheet" type="text/css" />


I've noticed that one of these methods requires a slash before the image URL like this....

background:url(/images/previous-arrows.gif)

rather than this...

background:url(images/previous-arrows.gif)

-------------
So there is some very specific and weird stuff going on here that some of us are having trouble with. I would like to know what exactly is causing these discrepancies so that I don't have to guess anymore.

Particularly, I would like to split up my templates into header and footer includes like the default templates and am curious why this should break my background-images in the CSS.
harveyappleton replied on at Permalink Reply
harveyappleton
Developed a simple addon to do this for you across whole site, and free! :) -http://www.concrete5.org/marketplace/addons/background-image/...