how to use the inherit and initial properties in css?

1

My CSS studies have resulted in finding the following properties: inherit and initial . The two at first sight seemed quite similar, but I wanted to know even it is:

Where can I use inherit and initial?

In what situations should I not use inherit and initial?

Initially I found the terms similar, but it would be nice to explain the difference between the two.

    
asked by anonymous 16.03.2017 / 15:49

1 answer

2

Basically the initial returns the initial value of the browser, so depending on the browser you use it may return a different value.

The inherit checks the value of the parent element, for example:

div{
color:red;
}
h1{
color:inherit;
}
<div>
    <h1>teste</h1>
</div>

If you put h1 with the initial value it will change the color to black, which is the browser default.

    
16.03.2017 / 16:19