Rajeev
Rajeev

Reputation: 46899

Border css for html table

I have two tables, one with the id ='data'. My question is that i want to apply the below border properties for the table id='data' only but from the below code the css is being applied to both the tables.How to correct this

<style>
table
{
   border-collapse:collapse;
}
table#data,th,td
{
   border:1px solid black;
}
</style>

Upvotes: 0

Views: 133

Answers (1)

fdiv_bug
fdiv_bug

Reputation: 881

this should work:

#data,
#data th,
#data td
{
   border:1px solid black;
}

because with table in the CSS selector You're gonna call all tables, unless You specify a class like table.class { ... } ;)

// edit

ok, i have to say:

table#data,
table#data th,
table#data td
{
   border:1px solid black;
}

will work also...

the main thing is, that You specify the ID or class of Your desired element in the CSS to get Your style applied to Your desired element...

Upvotes: 1

Related Questions