Answer the question
In order to leave comments, you need to log in
What is the difference between background and background-color?
Hello! I can't figure out the difference between background and background-color, when should I use one and when should I use the other? And also I don’t understand why use rgb and hsl if you can set the color simply through: #...?
Answer the question
In order to leave comments, you need to log in
The background
CSS property is just a shortcut that allows you to set several of the properties at once with a single value background-*
:
The specified values (in any order) set properties in the same way as individual statements. Not specified retain the default values.
Thus, it is background: #F90
completely equivalent background-color: #F90
. For example, it background: #F90 url(fon.jpg) repeat-x
is equal to
background-color: #F90;
background-image: url(fon.jpg);
background-repeat: repeat-x;
The difference is huge:
background is a whole set of properties:
background: url(/wp-content/themes/gorbunov_v2/img/review_client_bg.gif) repeat;
background-image: url(/wp-content/themes/gorbunov_v2/img/review_client_bg.gif);
background-position-x: initial;
background-position-y: initial;
background-size: initial;
background-repeat-x: repeat;
background-repeat-y: repeat;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: initial;
font-family: Arial, Sans-serif;
line-height:15px;
font-size:19px;
A background
lot of things can be included in, incl. Colour.
As far as I remember background-color
, it can override background
.
background-color is used specifically to convey color.
background - you can send an image :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question