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 trialMikus Sleiners
Courses Plus Student 234 Pointsinitial values
In the media queries example. Why bother setting initial values for some of the properties?
It seems to work well without doing that. When it comes to css I tend to stay away from setting things that I don't see making any effect...
Can you please explain?
According to stack oferflow it seems that initial value setting is just confusing people and should be avoided? http://stackoverflow.com/questions/18534561/what-is-use-of-initial-value-in-css
2 Answers
Tyler Dix
14,230 PointsIt may seem redundant, but setting initial values is useful if you're working with a team of developers. If you're learning CSS, likely you're the designer/front-end web developer. If the backend web developer needs to take a peak at your code, understanding initial (default) values would be useful information if he/she isn't an expert with CSS. I'd even add a comment next to initial noting that this is the default value.
If you're not working in a team, I see no use, and personally wouldn't use it. It breaks the DRY rule.
Hope that helps.
Matteo Simeone
13,587 PointsHi Mikus, take a look at this article about your question on initial value. I found it really interesting.
James Page
9,621 PointsJames Page
9,621 PointsHi Tyler,
I understand what you've just said, but I'm uncertain about when you would mention initial values. I mean, it's used in the media query, but not in other parts. What made Guil think "it's useful for me to insert initial values in this particular bit"?
Does initial inherit its initial value from the first time it was set in a style sheet? I was wondering if it might inherit it from, say, Normalize or the browser itself.
Regarding DRY... Does DRY only really apply if you're working on your own?