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 trialkabir k
Courses Plus Student 18,036 Pointsgrey vs. gray
In the Class Selectors lesson, they used the British spelling "grey" and not the American spelling "gray" as the value of the background property
Why is this? And can we use the American spelling "gray" instead of "grey"?
Here's a sample of the CSS code:
.primary-content { background: grey; }
3 Answers
Samuel Webb
25,370 PointsI just used both in the Safari Dev Tools and they worked. I'm not sure why the instructor used one over the other, but they both seem fine to use. At least in Safari.
Marcus Parsons
15,719 PointsHey Kabir,
You can use either spelling for your colors in all modern browsers. "grey" is the exact same as "gray" so you can interchange them. They're both included to accommodate both spellings. Even some of the other gray/grey color keywords work like that such as "slategrey" and "slategray".
Marcus Parsons
15,719 PointsAn easy way to test this is to bring up your web console in either Chrome or Firefox and typing these in one at a time (or copy and pasting one at a time):
document.body.style.backgroundColor = "grey";
document.body.style.backgroundColor = "gray";
You'll see that there's no difference in between the two colors.
kabir k
Courses Plus Student 18,036 PointsThanks, Marcus.
Christopher Sea
3,726 PointsThey are different colors:
Grey= #D3D3D3 OR Gray= #808080
kabir k
Courses Plus Student 18,036 Pointskabir k
Courses Plus Student 18,036 PointsThanks, Samuel. By the way, how do you access the Safari Dev Tools?
Samuel Webb
25,370 PointsSamuel Webb
25,370 PointsGo to the menu bar and click Safari>Preferences. When the window pops up, click the Advanced tab. At the bottom, there should be an option Show Develop in menu bar. Check that off. Now in the menu bar there should be a tab called Develop. Click it and pick the Show Page Source option.
Or, you can just right click anywhere on a web page and select Inspect Element.
kabir k
Courses Plus Student 18,036 Pointskabir k
Courses Plus Student 18,036 PointsGot it...thanks, Samuel.