Eric Gagné
Eric Gagné

Reputation: 11

How to change element style color

I am using wordpress and i am trying to change the color of a h1/h3 heading by css but i cant.

<div class="advisor-title-banner-header">
    <div class="hgroup">
        <a href="http://bashalaprairie.ca">
            <h1 style="color:#ffe2e2;">Basha La Prairie - (450) 444-1777</h1>
            <h3 style="color:#ffe2e2;">La meilleure cuisine libanaise</h3>
        </a>
    </div>
</div>

Problem:

element.style {
    color: #ffe2e2;
}

i want to change the color to red. I tried:

.element.style {
    color: red important!;
}

but it wouldnt work.

website: www.bashalaprairie.ca

I want to change the text color of Basha la prairie (450) 444-1777 - la meilleur cuisine lebanese from white to red

thanks!!!

Upvotes: 1

Views: 78

Answers (2)

Winter
Winter

Reputation: 4103

Your CSS rule isn't working because the exclamation mark goes on the other way of the important keyword:

Example:

element.style {
    color: red !important;
}

You also have to specify your element. For a h2, the rule should look like this:

h2.yourSpecificClass {
    color: red !important;
}

In addition, you have an extra dot (.) before your second example.

Upvotes: 2

BrunoLM
BrunoLM

Reputation: 100381

Read about CSS Selectors

To create a CSS to change the color of ALL h2 you could write

h2 {
  color: red;
}

If you want to be more specific you can add class selectors .classname and other things to narrow down to the single element.

Also it is !important instead of the way you wrote.

Upvotes: 0

Related Questions