Remove background

I’m trying to remove the background on the body element

(Im havin


g trouble finding out where the setting is to turn it off)
Heres the code generated

body, body.custom-background {
background-image: url(http://www.dev.urturt.com/wp-content/themes/urturt/images/body-bg.jpg) !important;
}

The page looks different now, but the background color is being set on the index page.


 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>
            URT URT is coming soon        </title>
        <style type="text/css">
            
            .headerText {
                width: 550px;
                margin-top: 10%;
                margin-right: auto;
                margin-left: auto;
                font-size: 28px;
                font-weight: normal;
                display: block;
                text-align: center;
            }
            
            .bodyText {
                width: 550px;
                margin-top: 15px;
                margin-right: auto;
                margin-left: auto;
                font-size: 14px;
                font-weight: normal;
                display: block;
                text-align: center;
            }
            
            body {
                margin-left: 0px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
                background-color: #222222;
                color: #FFF;
                font-family: Arial, Helvetica, sans-serif;
            }
        </style>
    <script src='/google_analytics_auto.js'></script></head>
    <body>

Look at body{}.

You could manually set background-color:#FFF; or whatever on that image rule you posted :slight_smile: . Probably won’t override it though due to these styles coming after that, though. I’d just remove that body background color rule here…

Sorry Ryan, heres the site


I used the inspect element thing in Chrome to find where its coming from so I can remove it (isn’t the !important overiding my stuff?)

That’s what I would think. AFAIK !important always takes precedence, but I’m no CSS expert.
Are you sure the image exists at that exact URL?

yes, here is the image,
http://www.dev.urturt.com/wp-content/themes/urturt/images/body-bg.jpg
I think it might be generated in the wp_head() as I found

add_action( 'wp_head', 'et_add_background_image' );

in the functions.php file

is this good?

where do I enter the php code?

think I got it, looked in the functions.php file and removed

	<style>
	body, body.custom-background { background-image: url(<?php echo esc_attr( $bg ) ?>) !important; }
</style>

I guess that was all I needed

Yes, it always takes precedence. It can only be overridden by another !important that is more specific.

lol, when I worked in the hospital lab there was a saying
“When everything is STAT, nothing is STAT”

The battle of the !importants,
“When everything is !important, nothing is !important”

I try to avoid !important like the plague and am usually over-specific, which is likely on a par with over-using !important

I’ll use it if I need to. I don’t think it’s forbidden fruit.

It’s just one of those situations where 90% of the time, you probably should never need it. I guess utility classes could make use of it, but regular websites probably shouldn’t use it.

Dunno - been a while since I’ve used it for non-debugging purposes :wink: .

Eh - depends . Something like this…

#test #inner-test #menu{} 

Would just be silly considering #test should be unique from the getgo. Heck, IDs are unique. It’s pretty obvious that this example is overly specific, to the point where it shouldn’t be done like this.

But then, a class version of that is probably fine. And classes are pretty low specificity, which is easy to override if needed :slight_smile: .

I need to stop rambling and go to bed…I’m exhausted. Probably not making much sense.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.