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 trial

CSS CSS Layout Techniques Display Modes Table Display

JUSANG YOU
JUSANG YOU
7,857 Points

I want to have a deeper understanding of "initial" value works. The existing answer is not enough to understand..

In Table display lessons when we make media queries for displaying .main-header elements properly in mobile. Instructor gave initial value on width,height and padding-left. How this is work?

5 Answers

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi JUSANG YOU,

Take a look at this lesson from the CSS Basics course. In the video, I cover the initial CSS value.

Isaac Asante
Isaac Asante
4,752 Points

Hi Jusang, the initial value resets an element to its default value. The default value may be the one first specified in the cascade.

JUSANG YOU
JUSANG YOU
7,857 Points

Hi, Isaac! Thanks for your answer! Ok.. then, if i declare initial value with some properties at media query, Its value turn back to original values from normalize.css? Every value to 0 ?(padding,margin: 0 ??)

Isaac Asante
Isaac Asante
4,752 Points

Well, the default value doesn't necessarily have to be from the normalize.css file. It's just that if it's not reset anywhere else, then yes, based on my experience, the default value would be retrieved from there.

JUSANG YOU
JUSANG YOU
7,857 Points

Oh, you're so kind. I have to try few cases to confirm its knowledge. Technique which related to responsive design always takes me to somewhere i don't understand well. Thanks!! I appreciate it.

Are you sure? I'm under the impression that you do not have the ability to set the initial value yourself. In other words, if you set the background color of the body element to red in your normalize.css, then change that color later in your style.css style sheet, but then set it to initial in a media query, the background color will not change back to red. Instead, it will change to the default of transparent.

JUSANG YOU
JUSANG YOU
7,857 Points

Thanks for your kind explanation!

Matteo Simeone
Matteo Simeone
13,587 Points

Reading this article helped me a lot in understanding the right use of the initial keyword.