tags:

views:

297

answers:

2

Hello!

I try to validate my CSS code. I have no errors, only warning, but i dont like it.

I have 100 warnings, like this ones:

45 Same colors for color and background-color in two contexts #search and div.main_text
45 Same colors for color and background-color in two contexts div.testinput and div.main_text
45  Same colors for color and background-color in two contexts #submit and div.main_text
221 Same colors for color and background-color in two contexts div.test input and #index_be
221 Same colors for color and background-color in two contexts #login_submit and 


div.main_text {
  color: #a3986d;
}

#search {
    background-color:#a3986d;
}

What should I do with this?

+1  A: 

Ignore it. Provided you never have HTML like this:

<div id="search">
    <div class="main_text">
    Hello!
    </div>
</div>

you'll be fine. If you do have markup like that, then the contents of the div with class main_text will have a background colour of #a3986d and a foreground colour of #a3986d, so text won't show up.

The fact that there is such a combination isn't a problem, unless you use that combination.

Dominic Rodger
A: 

for the Same action in CSS you can use following pattern. Note That with following code change all the mentioned class or ids so be carefull when you do this.

So To Apply one or multi attribute to a wide variety of classes or IDs seperate them with Comma like :

.MyFirstClass,   #YourFirstID,   div,   span
{
    /*any attribute you like to share with all of them*/
    color : black;
    background-color: #ebebeb;
}

So you have to remove all of 221 (or any other same numbers) attribute from all of 221 classes and just apply them in a series of classes. (it is better to do this in the top of your CSS class which whenever you change a sameproperty in the exact class, your change apply

Nasser Hadjloo
i dont understand. i use color prop. for div_main_text, and background-color properties for search. If i dot what you mentioned, then both properties will applied to both. So the text will be unvisible?!
Holian
never mind. i figure out..
Holian