+ 1
Plz,can anyone help me with this code ? I want to understand how the code exactly colored the line 2 and 3 in the second table ?
this is the code, sorry I tried to copy it and paste it here , but sadly with no success đ https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_id2
6 Answers
+ 2
table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color:#fff;
}
Odd and even are keywords that can be used to match child elements whose index is odd or even (the index of the first child is 1). - w3schools
And so, Jill's row is #eee, since it is tr:2 (even)
+ 2
thanking you @§hasan§
+ 1
the code isnt complete.. i'am trying to copy it from w3school, bit everytime it is nota complete đŹ
the styling is internal in the complete code.. so there is no external css..
this is the code with the output : https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_id2
+ 1
Html is incomplete too.
+ 1
cannot copy it successfully from the w3schools site đŹ I have no computer access ..
here is the link again if anyone wanna help and thanks đâ¤
https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_id2
+ 1
background-color: #eee; for grey and #fff; for white