James Raitsev
James Raitsev

Reputation: 96501

CSS, table border

If table is set to have a border on a high level, how can i make sure that classes inhering from it do not have any borders set?

table,td,th {
    border: 1px solid #0B6121;
}

how can i make sure that my other table has no borders at all?

table.menu {
    border: none;
    - and no border for td
    - and no border for th
}

Upvotes: 1

Views: 892

Answers (4)

MrGrigg
MrGrigg

Reputation: 1732

As your code stands

<table class="menu"></table>

will not have an outside border, but any th and td elements inside will inherit the border from your global selector.

The other answers that demonstrate applying specific rules to the td and th elements inside of a table with class of 'menu' should help you out.

Upvotes: 0

Sparkup
Sparkup

Reputation: 3754

Like this :

table.menu td, table.menu tr{
    border:none;
}

Upvotes: 1

user827080
user827080

Reputation:

table.menu, .menu th, .menu td {
    border:none;
}

sometyhing like this?

Upvotes: 2

Vladimir
Vladimir

Reputation: 4850

table.main, table.menu td, table.menu td {
    border: none;
}

This way I guess. The idea is to set rules for siblings of your particular table.

Upvotes: 2

Related Questions