Interview Questions

If background and color should always be set together, why do they exist as separate properties?

CSS Interview Questions and Questions


(Continued from previous question...)

4.If background and color should always be set together, why do they exist as separate properties?

There are serveral reasons for this. First, style sheets become more legible -- both for humans and machines. The background property is already the most complex property in CSS1 and combining it with color would make it even more complex. Second, color inherits, but background doesn't and this would be a source of confusion.

(Continued on next question...)

Other Interview Questions