• At the moment I have this piece of code…

    body.category-generation1 { background:url(10.jpg)!important; }

    I tried putting background-fixed in below it, but it doesn’t work – can anyone help? Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Alex

    (@alexdemchak)

    body.category-generation1 { background:url(10.jpg) fixed !important; }

    That should work – the old way of doing things was

    div { background-color: foobar;
    background-position: foobar;
    background-image: foobar;
    }

    etc, but thanks to shorthand properties you can combine them all on one line
    div { background: #fff url(x.jpg) fixed; }

    Hope this works ??

    Other than css, maybe something like this in your category template? I use it to show category title images but maybe you could adapt to your purpose..? Although if the css solution above works, is probably best.

    <?php if (is_category('news')) { ?>
    	<h2 class="cat-title"> 
    
    <img 
    
    src="https://foursticks.net/harborsmu
    
    sic/wp-includes/images/news.jpg">
    </h2> 
    
    <?php } ?>
    
    <?php if (is_category('shows')) { ?>
    	<h2 class="cat-title"> 
    
    <img 
    
    src="https://foursticks.net/harborsmu
    
    sic/wp-includes/images/shows.jpg">
    </h2>
    
    <?php } ?>
    Thread Starter thesimling

    (@thesimling)

    Sadly, it’s not working… this is the blog in question. As you can see, even with the updated CSS it doesn’t work and the background “moves.”

    I’m not very experienced so I can’t write code or really figure it out, does anyone have any-more ideas.

    Thread Starter thesimling

    (@thesimling)

    Sorry, but I had to add…

    What if you tried to tell me what the full code would be for the old way of doing it (I don’t know what to put)? Thanks.

    Oh my, this is the first time I’ve seen it, are you sure you’re not talking about the content area? it moves, the background is fixed.
    Now it looks like you need a transparent content area?

    Sorry if I was diverted by the category-background reference, perhaps this is what you are trying to do, the opposite of what you may have thought:

    body.category-generation1 {
        background: url("10.jpg") repeat scroll 0 0 transparent !important;
    }

    You want your background to scroll, it was already fixed and the content area was scrolling above it. This will make them scroll together.

    you can also do this:

    #wrapper {
        background: none repeat fixed 0 0 transparent;
        margin-top: 20px;
        padding: 0 20px;
    }

    or this

    #wrapper {
        background: none repeat fixed 0 0 transparent;
        margin-top: 20px;
        padding: 0 20px;
    }

    or this:

    body.category-generation1 {
        background: url("10.jpg") repeat fixed 0 0 transparent !important;
    }

    play around!

    this is cool too: opacity, can be fixed or scroll:

    #wrapper {
        background: none repeat scroll 0 0 #FFFFFF;
        margin-top: 20px;
        opacity: 0.6;
        padding: 0 20px;
    }

    but you’d have to make fonts darker.

    Thread Starter thesimling

    (@thesimling)

    I was going to ask about changing the opacity of the content area… ideally I would like a black transparent background (and knowledge on how to change all of the font colours)? That would be good! ??

    UGH, just refreshed my browser. All it needed was a simple refresh to get the background fixed!!! ??

    ideally I would like a black transparent background

    Do you mean black opaque? also, are you talking about the background? there’s nothing behind it to show through, so I’m not sure why transparent? You must mean the content area? just change the color in the code I provided, you can also adjust opacity, higher number is less transparent.

    #wrapper {
        background: none repeat scroll 0 0 #000000;
        margin-top: 20px;
        opacity: 0.6;
        padding: 0 20px;
    }

    “All the font colors” wil have to be dealt with one at a time.

    hmmm, actually somethings not right with this, ideally the background of the content area should be opaque without effecting the content opacity. As it stands your content will be semi transparent, not good. I’ll have to poke around more.

    Okay, this coding is more complicated than I thought. after reading up on it, the prefered way to get opacity is with an opaque .png image set as the image for your container. I’d definately concider that route.
    If you don’t have the means to do that I could send you one, it’s easier than any support I give on this forum, so no problem. Problem is i can’t see a way to show my email in my profile, and we’re not supposed to post them in the forum..?

    turns out you just have to click my user name, or so I’m told.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Making a Category background fixed?’ is closed to new replies.