frequent
frequent

Reputation: 28503

Can CSS be inherited from adjacent elements?

So, I'm doing this:

.ui-table-wrapper-top {
    border-width: 1px 1px 0;
}
.ui-table-wrapper-bottom {
    border-width: 0 1px 1px;
}
/* pass this to the table ... */
.ui-table-wrapper-top ~ table,
.ui-table-wrapper-bottom ~ table {
    border: 1px solid;
}

telling a table that has a wrapper that it would get a border.

Question:
If some other element set this:

.ui-page-theme-foo .ui-table-wrapper-top,
.ui-page-theme-foo .ui-table-wrapper-bottom {
    border-color: red;
}

Is there a way to inherit this color to the table, because it should only get a border color, if it has a wrapper (top/bottom)?

Upvotes: 0

Views: 177

Answers (1)

Jon
Jon

Reputation: 437386

Unfortunately not. You cannot affect the way property inheritance works through CSS (i.e. make an element inherit from anywhere but its parent); you can only override it by making an element inherit when it would normally not have and the reverse.

Upvotes: 1

Related Questions