how to find if an element has a color property of white?
I'm using this and it doesn't return anything to me
function returnColorValue(that) {
//that equal to a jq object
if (that.css("color") == '#ffffff' || that.开发者_开发问答css("color") == '#fff' || that.css("color") == 'white' || that.css("color") == 'rgb(255, 255, 255)' || that.css("color") == 'rgba(255, 255, 255)') {
console.log(that.css("color"));
}
}
and stranger than that- each browser will use a different method. In chrome and ff i found nothing. I used also rgba and it didn't help me at all...
I cannot compare to any classes (like was suggested here) cause the value of this classes changes between contexts of different pages.
Thanks for all the helpers.
Shlomi.
The CSS property for background color is, quite literally, background-color
. The color
property refers to the foreground, or text, color.
If you are looking for the background color, you want to use the css property background-color
.
精彩评论