Search code examples
htmlcss

CSS color vs. background-color vs. background?


In HTML when do I use color, and what is the difference between background-color and also the background tag?

What are the differences?


Solution

  • color is referring to the text color in that element.

    background-color refers to the background color

    background is shorthand to combine many background tags into one line.

    background: #ffffff url("img_tree.png") no-repeat right top;
    

    Combines color, image and background image properties in the one line instead of typing our each style individually.

    w3schools