Skip to content
Fragmented Development

Custom Color Caution

Just a quick tip to keep in mind when overriding default color values on elements with CSS: Make sure to override all colors involved.

I have been bitten by this in some of my own sites. When I switched over to a dark theme in Openbox, all of the form controls inside web pages inverted from their usual colors; they now had black backgrounds and white text. This presented problems when people would change the text color or the background color of input fields, but allow the other property to stay with the default.

I can't tell you how many times I tried to enter something in a web form, only to realize that I wasn't going to be able to read the text I was entering, because the web site designer decided to specify black text on top of my black form fields.

The moral of the story: If you're specifying the color property, make sure to specify background-color as well!

Tags: css


Add Your Comment