html - Why the columns are different colored? -
i've made table divs, , want every second row different colored. every columns different colored. problem?
.mtable { display: table; width: auto; background-color: #eee; border: 1px solid #666666; } .mtablerow { display: table-row; width: auto; clear: both; } .mtableheading { display: table-header-group; background-color: #ddd; height: auto; color: black; text-align: center; border-bottom: 1px solid #000000; border-bottom: 1px solid #000000; } .mtablecell, .mtablehead { display: table-cell; padding: 5px; border: 1px solid #999999; text-align: center; color: black; border-bottom: 1px solid #000000; width: 200px; background-color: #ccc; } .mtablerow>div:nth-child(even) { background: blue; }
<div class="mtable"> <div class="mtablerow"> <div class="mtablehead">id</div> <div class="mtablehead">név</div> <div class="mtablehead">komment</div> <div class="mtablehead">tól</div> <div class="mtablehead">ig</div> </div> <div class="mtablerow"> <div class="mtablecell">9</div> <div class="mtablecell">robi1 </div> <div class="mtablecell"> </div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> <div class="mtablerow"> <div class="mtablecell">31</div> <div class="mtablecell">fŰtÉs </div> <div class="mtablecell">hőszivattyú teremhőmérsékletek</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> <div class="mtablerow"> <div class="mtablecell">36</div> <div class="mtablecell">növényház</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> <div class="mtablerow"> <div class="mtablecell">93</div> <div class="mtablecell">Üvegház</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> <div class="mtablerow"> <div class="mtablecell">94</div> <div class="mtablecell">cserepes fűtés-hűtés</div> <div class="mtablecell">2017 február 9.-i állapott</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> <div class="mtablerow"> <div class="mtablecell">95</div> <div class="mtablecell">cserepes 2017</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> <div class="mtablerow"> <div class="mtablecell">96</div> <div class="mtablecell">3 fő helyiség</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"><button class="w3-button w3-round-xxlarge w3-aqua">választom</button></div> </div> </div> </div> </div> </div>
just css wrong replace this:
.mtablerow:nth-child(even) div { background: blue; }
.mtable { display: table; width: auto; background-color: #eee; border: 1px solid #666666; } .mtablerow { display: table-row; width: auto; clear: both; } .mtableheading { display: table-header-group; background-color: #ddd; height: auto; color : black; text-align: center; border-bottom: 1px solid #000000; border-bottom: 1px solid #000000; } .mtablecell, .mtablehead { display: table-cell; padding: 5px; border: 1px solid #999999; text-align: center; color : black; border-bottom: 1px solid #000000; width: 200px; background-color: #ccc; } .mtablerow:nth-child(even) div { background: blue; }
<div class="mtable"> <div class="mtablerow"> <div class="mtablehead">id</div> <div class="mtablehead">név</div> <div class="mtablehead">komment</div> <div class="mtablehead">tól</div> <div class="mtablehead">ig</div> </div> <div class="mtablerow"> <div class="mtablecell">9</div> <div class="mtablecell">robi1 </div> <div class="mtablecell"> </div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> <div class="mtablerow"> <div class="mtablecell">31</div> <div class="mtablecell">fŰtÉs </div> <div class="mtablecell">hőszivattyú teremhőmérsékletek</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> <div class="mtablerow"> <div class="mtablecell">36</div> <div class="mtablecell">növényház</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> <div class="mtablerow"> <div class="mtablecell">93</div> <div class="mtablecell">Üvegház</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> <div class="mtablerow"> <div class="mtablecell">94</div> <div class="mtablecell">cserepes fűtés-hűtés</div> <div class="mtablecell">2017 február 9.-i állapott</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> <div class="mtablerow"> <div class="mtablecell">95</div> <div class="mtablecell">cserepes 2017</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> <div class="mtablerow"> <div class="mtablecell">96</div> <div class="mtablecell">3 fő helyiség</div> <div class="mtablecell">sablon komment</div> <div class="mtablecell">null</div> <div class="mtablecell">null</div> <div class="mtablecell"> <button class="w3-button w3-round-xxlarge w3-aqua">választom</button> </div> </div> </div> </div> </div> </div>
Comments
Post a Comment