Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialroberthopman
16,502 PointsWhat is the correct order of the background property values?
I was looking for some research on the background and what kind of other properties there are. I discovered that the order is as follows:
background: #ffffff url("img_tree.png") no-repeat right top;
This is the source that showed up in the google search results at the top: http://www.w3schools.com/css/css_background.asp
In one of the previous videos we got: h1 { float: left; margin: 0; text-indent: -20000px; width: 300px; height: 66px; background: url('../images/widget.png') top left no-repeat; }
so there the no-repeat and top left are switched.
What is the "official" or "right" way to order these values?
1 Answer
egaratkaoroprat
16,630 PointsHi Robert
There is no official way for this - the value can be in any order. But I would suggest to use the more specific properties such as background-image
, as it makes your code easier to understand. Unless you have a very large CSS files, which needs to be as efficient as possible, I would not use the background
-property.
Also, I am not a big fan of w3schools, as they lack a lot of information. Use the MDN reference instead. :) https://developer.mozilla.org/en/docs/Web/CSS/background