Reputation: 3192
I am trying to have a normal class for tables, e.g.
table {style here}
But for some tables I'd like to have a different style
I could just give the table a class and then use that class alone, e.g.
.specialTable {special style}
But I'd like to try specifying that this is just applicable to tables, e.g.
.specialTable table {special style}
However this isn't working, what's wrong?
Upvotes: 0
Views: 67
Reputation: 1
.specialTable table
Is selecting tables that are descendants of elements with the .specialTable
class.
You want table.specialTable
, which selects tables with the class specialTable.
Upvotes: 0
Reputation: 70052
.specialTable table
specifies a table
element within an element with the class specialTable
.
You want table.specialTable
, which means any table
with the class specialTable
.
Upvotes: 3
Reputation: 19319
It would help if you showed your HTML but I think I see what you're getting at.
<table class="specialTable">
is not what your CSS specifies. Instead it specifies something like
<div class="specialTable"><table>...</table></div>
Instead in your CSS you can do
table.specialTable { ... }
Upvotes: 0
Reputation: 19476
.specialTable table {special style}
The above code will affect any table which has an ancestor (a previous element) with the class specialTable
. That will for instance match the table in
<body class="specialTable">
...
<table>
...
What you want is a table with the class specialTable
in which case the syntax is
table.specialTable {special style}
Upvotes: 0