0
background:#777777 none repeat scroll 0 0;

the 5 attributes it includes are background-color,background-image,background-repeat,background-attachment and background-position.

My question is:

Are background-repeat,background-attachment and background-position useless if background-image is none? Because according to the document,these are all used to change background-image.

3 Answers 3

2

yes. They have no meaning without that.

Sign up to request clarification or add additional context in comments.

2 Comments

So it's a waste of code,right? The same as background:#777777 none?
yes. If you just want to set the background color, you can just do background-color: #777777;
1

You can simply write

background:#777777;

or,

background-color:#777777;

All of those attributes affect the image only.

In general, if a CSS attribute sets multiple values (eg, background, border, font), you don't need to specify all of the values; any values you don't specify will be left at their defaults.

1 Comment

oh,background:#777777; this version is more compact than background:#777777 none
0

IF you just want a background color, consider using the background-color attribute instead of background.

1 Comment

Though keep in mind, background-color will not override a background-image set elsewhere...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.