So i've watched a lecture on CSS rules inheritance and I was curious about how it would hork with HTML tables, so i tried to test some code to get a better understanding of inheritance.
I wrote the following code:
table{
border: 1px solid black;
color: greenyellow;
}
.Table2, .th2{
border: 1px solid black;
color: greenyellow;
}
<!DOCTYPE html>
<hmt lan="en">
<head></head>
<body>
<table class="Table">
<tr>
<th>
Style
</th>
<th>
ID
</th>
<th>
# of Classes, Pseudo-Classes
</th>
<th>
# of Elementes
</th>
</tr>
</table>
<br><br>
<table class="Table2">
<tr>
<th class="th2">
Style
</th>
<th class="th2">
ID
</th>
<th class="th2">
# of Classes, Pseudo-Classes
</th>
<th class="th2">
# of Elements
</th>
</tr>
</table>
</body>
</html>
i was specting both CSS codes to look the same, since the <th> tag seems to be a child of the <table> tag. In fact, with the first CSS rule, the Color property did inherit from <table> to <th>, and the text defined in <th> was green, BUT the border property does not seems to be inherited. In the first case, i just get by result an square around my table, in the second case i get that same square but with little squares surrounding each sentence.
Result from the first CSS rule to <table>
Result of the second CSS rule to <table> <th>
Now my question is: Why <th>didn't inherit the border property in the first case, are there some properties that does not pass from parent to child, if so, where can i find them? Or maybe <th> is defined not to be <table> child? What is happening here?