jquery - css for particular table's rows and columns -


i have many html tables , 1 of these named "table1". want give style table only. used:

#table1 tr,th,td   {     border: 5px solid black;   } 

but when executed, other table's td , tr, th style setted same #table1 's style.

how can give style particular table's td , tr, th only????

you need specify parent th , td

#table1 tr, #table1 th, #table1 td {     /* ... */ } 

otherwise apply style

  • #table1 tr (all tr inside #table1)
  • th (all th no matter are)
  • td (all td no matter are)

as side note, on modern browser :any pseudoclass is available (with -moz- , -webkit- prefixes) implemented more consistently write

#table1 :any(tr, th, td) {    ... } 

useful avoid repetition.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -