nth-type
次のようなカウンターを持つことは可能ですか?
td:nth-of-type(counter(section)):before {
content: "Date"counter(section);
counter-increment: section;
}
カウンターは次のように初期化されます
#myTable tr {
border: 1px solid #ccc;
counter-reset: section;counter-increment: section;
}
私がやろうとしているのはこれです-tr
クラスiRがあるかどうかを確認し、そうであれば、構造は次のようになります:
table.myTable td:nth-of-type(1):before { content: "Date"; }
table.myTable td:nth-of-type(2):before { content: "Fajr"; }
table.myTable td:nth-of-type(3):before { content: "Fr"; }
table.myTable td :nth-of-type(4):before { content: "Se"; }
table.myTable td:nth-of-type(5):before { content: "Dr"; }
table.myTable td:nth-of-type(6):before { content: " "; }
table.myTable td:nth-of-type(7):before { content: "A"; }
table.myTable td:nth-of-type(8):before { content: " "; }
table.myTable td:nth-of-type(9):before { content: "Mb"; }
table.myTable td:nth-of-type(10):before { content: " "; }
table.myTable td:nth-of-type(11):before { content: "I"; }
table.myTable td:nth-of-type(12):before { content: ""; }
でないとこうなる
table.myTable td:nth-of-type(1):before { content: "Date"; }
table.myTable td:nth-of-type(2):before { content: "Fr"; }
table.myTable td :nth-of-type(3):before { content: "Se"; }
table.myTable td:nth-of-type(4):before { content: "Dr"; }
table.myTable td:nth-of-type(5):before { content: "A"; }
table.myTable td:nth-of-type(6):before { content: "Mb"; }
table.myTable td:nth-of-type(7):before { content: "I"; }
これが私がやろうとしているjsfiddleです https://jsfiddle.net/wj5gnafm/1/