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 trialStaclin Patterson
3,105 PointsWhy is it necessary to add a space between a property and it's values?
Just out of curiosity I was wondering why it was necessary to add a space between a property and its value(s)? Example: {font-size: 20px;} Is it just to make the code easier to read, or does it serve a functional purpose?
4 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHi Staclin,
No, in this case, it's just to make the code easier to read. Though you could eliminate the space, the convention in CSS is to have the space. But, for the most part, whitespace doesn't matter in CSS.
Keep Coding! :)
nfs
35,526 PointsYou can find the importance of whitespace in a few programming languages like python and some others (some esoteric languages are even based on whitespaces). But HTML and CSS is not a whitespace sensitive language. (Moreover, HTML and CSS are not technically programming languages either...)
Therefore, as stated, it makes the code easier to read. (You need to minify and remove all the unnecessary characters and spaces in the code before deploying anyway).
Happy coding.
Xayaseth Boudsady
21,951 PointsAs stated above; for readability. You may have to return to your code eventually, and the easier it is to spot them, the easier it is to debug.
Hamo Azad
Courses Plus Student 45 PointsIdk