html - understanding cascading and css initial -


so have html css

.paragraphs {    color: orange;    background-color: gray;  }    p.first {    color: inherit;    background-color: inherit;  }    p.second {    color: initial;    background-color: initial;  }
<div class="paragraphs">    <p class="first">paragraph 1</p>    <p class="second">paragraph 2</p>  </div>

both have background-color of gray p.first have color of orange , p.second have color of black.

why background-color not go it's default state background-color: initial; color: initial; does?

because initial of background-color on p-tag transparent or none.

you can see computed style of second p tag when inspecting elements. there see background-color has value rgba(0, 0, 0, 0) same transparent black.

there article on quirksmode.org inherit, initial , unset values.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -