Jaws212
Jaws212

Reputation: 770

Overriding CSS background property

I have a container that inherits some settings from a global css file by assigning it a class name. However, when I try to use another class to more specifically set the background, nothing changes.

The interesting parts of my html:

    <html>
        <head>
            <link rel="stylesheet" type="text/css" href="/styles/global.css">
            <link rel="stylesheet" type="text/css" href="/styles/register.css">
        </head>
        <body class="class1 class2">
            <div>
                some content
            </div>
        </body>
    </html>

And the CSS for global

    .class1 {
        /*Shadowing for 3D effect*/
        -moz-box-shadow:inset 0px 1px 2px 0px #caefab; /*pale green*/
        -webkit-box-shadow:inset 0px 1px 2px 0px #caefab; /*inner/outer, hz-offset, vert-offset, blur-rad, spread, color*/
        box-shadow:inset 0px 1px 2px 0px #caefab;
        /*Background gradient effect*/
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #46bf46), color-stop(1, #1d911d) ); /*dark green to light green*/
        background:-moz-linear-gradient( center top, #46bf46 5%, #1d911d 100% );
        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#46bf46', endColorstr='#1d911d');
        /*Rounded corners*/
        -moz-border-radius:10px;
        -webkit-border-radius:10px;
        border-radius:10px;
        /*Border*/
        border:1px solid #46bf46;
        /*text settings*/
        color: white; /*like chalk*/
        text-decoration:none; /*this is default*/
        text-shadow:1px 1px 0px #777; /*hzoff vtoff blur color*//*gray makes letters pop out*/
        font-family:Verdana, sans-serif;
        font-size:20px;
        font-weight:bold;
    }

And finally CSS for register

    .class2 {
        color: black;
        background-color: lightgray;
    }

The text color is overriding perfectly but I can't get the background to change.

Upvotes: 0

Views: 917

Answers (1)

ignacioricci
ignacioricci

Reputation: 1276

text-color doesn't exist on CSS. It's color.

Regarding the background, try using the background property alltogether and not just background-color. Maybe the browser gradients are overriding it.

Upvotes: 2

Related Questions