CSS Background Image & .post-id-number class?
-
I ran into a weird problem and I’m wondering if there’s just some rule I don’t know about CSS or WordPress. I wanted to make a single page a different background image, all fine and good, found a CSS shortcut from the forums.
I tried
body.page-id-101 { background: url('absolute path to image in childtheme img dir'); }
Nothing. Checked w/Inspect Element in Chrome to make sure nothing was overriding…tried a few things such as
- !important
- relative path instead of absolute
- a different image altogether
- CHMOD the image (but it was at 604 like every other image in the folder)
but the only way to make it work was to put the image in the wp root folder, alongside the .htaccess etc. I have no idea why this would be since images in the same child theme directory are correctly called by the body general and a separate page using the .page-template-custom-php class — my only guess is that the .page-id-number class is something too specific to call back to the URL of the image?
EDIT: Forgot to say, this image loads properly on direct access
For now I can use the wp root for the background image but I would really prefer to know why this class wasn’t working with images. I should also mention it works fine for background colors and gradients; it only doesn’t work with a URL image in that directory for the child theme.
Another alternative is to make another custom template for this page, but I haven’t needed to with such specific CSS. Still. Why would this happen?
EDIT AGAIN: I just tried the .page-template-custom-php class and no dice. I am clearly going insane because this worked for a different page with another image.
Any ideas?
Thanks.
P.S. Current theme is CyberChimps’ Responsive, but I’m not sure if this is truly tied to the theme and not a WordPress issue since post-id class seems universal?
- The topic ‘CSS Background Image & .post-id-number class?’ is closed to new replies.