- 1

How to define parent and child?

Why here "body" is "p"'s parent?

30th Jan 2017, 8:23 AM
Eunice
2 odpowiedzi
+ 9
<body> <p></p> </body>
30th Jan 2017, 9:00 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
Think to a family tree structure... the older ancestor is the html document ( to sipmplify ), called <html>. This first 'parent' contain two different part, as <head> and <body>, considered as his 'childs'. But each 'child' can be a 'parent' too, with 'childs contents'... So displaying a graph of the 'family tree' from your document, can be: <html> / \ <head> <body> / | | \ / | | \ <p><p><p><p> / | \/ | \/ | \/ | \ ... Inheritance of Cascading Stlyle Sheet consist to apply attributes defined on a parent element to its childs. So, if you define a css rule as 'color:red;' for the <body> element, all its childs will have a 'color:red' by default, until another css rule override it...
31st Jan 2017, 9:28 AM
visph
visph - avatar