CSS Inheritance | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

CSS Inheritance

But the mydiv didn't mention the p element in it. So way the p get to style as mydiv?

8th Mar 2017, 7:30 PM
Sam Malekahmadi
Sam Malekahmadi - avatar
1 Answer
+ 1
In CSS style is inherited. If you apply a style to body then it will also be applied to entire page. Ex; body { color: white; } above snippet will color text, border, etc white until overwritten. This rule is same for all parent and child elements.
8th Mar 2017, 8:21 PM
Ravindra Sisodia
Ravindra Sisodia - avatar