WordPressの追加プラグインで便利な表を
記事内に挿入できるプラグインのメモです。
Tablepressの特殊な使い方
TablePress
●テーブルの特定のセルの背景色を変える
カスタムCSSへ
.tablepress-id-(テーブルID) .row-(左から何番目のセルか) .column-(上から何番目のセルか) {
background-color: (カラーコード) !important; /* 背景色の指定 */
}
/* 文字色を指定する場合 */
color: カラーコード !important;
*ヘッダーも1列目に含まれます。
記述例:
.tablepress-id-1 .row-2 .column-4,
.tablepress-id-1 .row-5 .column-3 {
background-color: #40E0D0 !important; /* 背景色 */
color: #ffffff !important; /* 文字色 */
}
| 見出し1 | 見出し2 | 見出し3 | 見出し4 |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 |
!important
優先したい場合に付ける。
テーブル全体の高さと幅指定
.tablepress-id-9,
.tablepress-id-10 {
width: 1025px;
height: 2000px;
}
.tablepress-id-〇〇 => テーブルのIDナンバーを指定
width = 幅 、height = 高さ
pxや%で指定可能。