0

Inheritance in CSS

<head><style> body{Color:green;} .div{color:Red;} </style> </head> <body> <div class="div"> <p> this is some text</p> </div> </body> Now Why the Paragraph in the Body section uses red color instead of green which is defined as a color for the body section.

22nd Nov 2016, 1:09 AM
Shanmugarajan Kalyanasundarsam
Shanmugarajan Kalyanasundarsam - avatar
2 odpowiedzi
+ 2
Divs are separated of the body , the <p> will give the precedence to the div style . And actually this is why we use divs
22nd Nov 2016, 3:19 AM
Amine Karimi
Amine Karimi - avatar