{"id":12913,"date":"2026-06-25T03:29:18","date_gmt":"2026-06-24T18:29:18","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=12913"},"modified":"2026-07-07T00:23:16","modified_gmt":"2026-07-06T15:23:16","slug":"nth-of-type-12913","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/nth-of-type-12913\/","title":{"rendered":"nth-\u7cfb\u30bb\u30ec\u30af\u30bf\u3068\u30af\u30e9\u30b9\u540d\u6307\u5b9a\u306e\u5b8c\u5168\u30ac\u30a4\u30c9\uff1aCSS\u3067\u300c\u4f55\u756a\u76ee\u304b\u300d\u3092\u6307\u5b9a\u3059\u308b"},"content":{"rendered":"<p>\u300c\u6700\u521d\u306e\u8981\u7d20\u3060\u3051\u30b9\u30bf\u30a4\u30eb\u3092\u5909\u3048\u305f\u3044\u300d\u300c\u6700\u5f8c\u306e3\u3064\u3060\u3051\u30de\u30fc\u30b8\u30f3\u3092\u306a\u304f\u3057\u305f\u3044\u300d\u2014\u2014\u3053\u3046\u3044\u3063\u305f\u4f4d\u7f6e\u30d9\u30fc\u30b9\u306e\u6307\u5b9a\u306fCSS\u3067\u3088\u304f\u66f8\u304f\u3002<code>:nth-of-type()<\/code> \u306e\u57fa\u672c\u304b\u3089\u3001<code>:nth-child<\/code> \u306e <code>of<\/code> \u69cb\u6587\u3001<code>:is()<\/code> \/ <code>:not()<\/code> \/ <code>:has()<\/code> \u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u300c\u30af\u30e9\u30b9\u30d9\u30fc\u30b9\u306e\u4f4d\u7f6e\u9078\u629e\u300d\u307e\u3067\u6574\u7406\u3059\u308b\u3002<\/p>\r\n\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">1. :nth-child \u3068 :nth-of-type \u306e\u9055\u3044<\/h2>\r\n<p>\u307e\u305a\u57fa\u672c\u306e\u9055\u3044\u3092\u62bc\u3055\u3048\u308b\u3002\u3069\u3061\u3089\u3082\u300c\u4f55\u756a\u76ee\u304b\u300d\u3092\u6307\u5b9a\u3059\u308b\u304c\u3001\u6570\u3048\u65b9\u304c\u7570\u306a\u308b\u3002<\/p>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n  <li><code>:nth-child(n)<\/code> \u2014 \u89aa\u8981\u7d20\u5185\u306e\u4e3b\u8981\u306a\u5b50\u8981\u7d20\u3092\u9806\u756a\u306b\u6570\u3048\u308b\uff08\u30bf\u30b0\u540d\u3092\u554f\u308f\u306a\u3044\uff09<\/li>\r\n  <li><code>:nth-of-type(n)<\/code> \u2014 \u540c\u3058\u30bf\u30b0\u540d\u306e\u8981\u7d20\u3060\u3051\u3092\u9806\u756a\u306b\u6570\u3048\u308b<\/li>\r\n<\/ul>\r\n\r\n<pre><code class=\"language-css\">\/* dl :nth-child(3) \u2192 \u5b50\u8981\u7d20\u306e3\u756a\u76ee \u2192 [2] list-term\uff08dt\uff09 *\/\r\ndl :nth-child(3) {}\r\n\r\n\/* dt:nth-of-type(2) \u2192 dt\u306e2\u756a\u76ee \u2192 [2] list-term *\/\r\ndt:nth-of-type(2) {}\r\n\r\n\/* dd:nth-of-type(2) \u2192 dd\u306e2\u756a\u76ee \u2192 [2] list-data *\/\r\ndd:nth-of-type(2) {}<\/code><\/pre>\r\n\r\n<blockquote>\r\n  <p>\u30dd\u30a4\u30f3\u30c8\uff1a<code>:nth-child<\/code> \u306f\u30bf\u30b0\u3092\u307e\u305f\u3044\u3067\u6570\u3048\u3001<code>:nth-of-type<\/code> \u306f\u30bf\u30b0\u540d\u3054\u3068\u306b\u6570\u3048\u308b\u3002<\/p>\r\n<\/blockquote>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">2. \u9806\u756a\u6307\u5b9a\uff1a:nth-of-type \u3068 :nth-last-of-type<\/h2>\r\n<p><code>:nth-of-type(An+B)<\/code> \u306e <code>n<\/code> \u306f 0, 1, 2, 3... \u3068\u5897\u3048\u308b\u6574\u6570\u3002<code>A<\/code> \u304c\u5468\u671f\u3001<code>B<\/code> \u304c\u958b\u59cb\u4f4d\u7f6e\u3002<code>:nth-child<\/code> \u3082\u540c\u3058\u5f0f\u304c\u4f7f\u3048\u308b\u304c\u3001\u6570\u3048\u65b9\u304c\u4e0a\u8a18\u306e\u901a\u308a\u7570\u306a\u308b\u3002<\/p>\r\n<h3 class=\"fz-ml\">\u524d\u304b\u3089\u6570\u3048\u308b<\/h3>\r\n<pre><code class=\"language-html\">\r\n  [1] list-item\r\n  [2] list-item\r\n  [3] list-item\r\n  [4] list-item\r\n  [5] list-item\r\n  [6] list-item\r\n<\/code><\/pre>\r\n<pre><code class=\"language-css\">\/* \u6700\u521d\u306e\u8981\u7d20 \u2192 [1] *\/\r\n:nth-of-type(1) {}\r\n\r\n\/* \u6700\u521d\u4ee5\u5916\uff082\u756a\u76ee\u4ee5\u964d\uff09 \u2192 [2][3][4][5][6] *\/\r\n:nth-of-type(n+2) {}\r\n\r\n\/* \u6700\u521d\uff5e3\u756a\u76ee \u2192 [1][2][3] *\/\r\n:nth-of-type(-n+3) {}\r\n\r\n\/* 4\u756a\u76ee\u4ee5\u964d \u2192 [4][5][6] *\/\r\n:nth-of-type(n+4) {}\r\n\r\n\/* 4\u756a\u76ee\uff5e6\u756a\u76ee \u2192 [4][5][6] *\/\r\n:nth-of-type(n+4):nth-of-type(-n+6) {}<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml\">\u5f8c\u308d\u304b\u3089\u6570\u3048\u308b<\/h3>\r\n<pre><code class=\"language-css\">\/* \u6700\u5f8c\u306e\u8981\u7d20 \u2192 [6] *\/\r\n:nth-last-of-type(1) {}\r\n\r\n\/* \u6700\u5f8c\u4ee5\u5916 \u2192 [1][2][3][4][5] *\/\r\n:nth-last-of-type(n+2) {}\r\n\r\n\/* \u6700\u5f8c\uff5e\u5f8c\u308d\u304b\u30893\u756a\u76ee \u2192 [4][5][6] *\/\r\n:nth-last-of-type(-n+3) {}\r\n\r\n\/* \u5f8c\u308d\u304b\u30894\u756a\u76ee\u4ee5\u524d \u2192 [1][2][3] *\/\r\n:nth-last-of-type(n+4) {}\r\n\r\n\/* \u5f8c\u308d\u304b\u30894\u756a\u76ee\uff5e\u5f8c\u308d\u304b\u30896\u756a\u76ee \u2192 [1][2][3] *\/\r\n:nth-last-of-type(n+4):nth-last-of-type(-n+6) {}<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u524d\u5f8c\u3092\u7d44\u307f\u5408\u308f\u305b\u308b<\/h3>\r\n<pre><code class=\"language-css\">\/* \u6700\u521d\u3068\u6700\u5f8c\u4ee5\u5916 \u2192 [2][3][4][5] *\/\r\n:nth-of-type(n+2):nth-last-of-type(n+2) {}\r\n\r\n\/* 4\u756a\u76ee\u4ee5\u964d\u304b\u3064\u5f8c\u308d\u304b\u30894\u756a\u76ee\u4ee5\u524d *\/\r\n:nth-of-type(n+4):nth-last-of-type(n+4) {}<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u5358\u72ec\u8981\u7d20\u306e\u9664\u5916<\/h3>\r\n<pre><code class=\"language-css\">\/* \u6700\u521d\u306e\u8981\u7d20\uff081\u3064\u3057\u304b\u306a\u3044\u5834\u5408\u306f\u9664\u5916\uff09 *\/\r\n:nth-of-type(1):not(:only-of-type) {}\r\n\r\n\/* \u6700\u5f8c\u306e\u8981\u7d20\uff081\u3064\u3057\u304b\u306a\u3044\u5834\u5408\u306f\u9664\u5916\uff09 *\/\r\n:nth-last-of-type(1):not(:only-of-type) {}<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u5947\u6570\u30fb\u5076\u6570\u30fb\u30b0\u30ea\u30c3\u30c9\u4f4d\u7f6e<\/h3>\r\n<pre><code class=\"language-css\">\/* \u5947\u6570\u756a\u76ee\uff08odd \u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u3082\u540c\u3058\uff09 *\/\r\n:nth-of-type(2n+1) {}\r\n:nth-of-type(odd)  {}\r\n\r\n\/* \u5076\u6570\u756a\u76ee\uff08even \u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u3082\u540c\u3058\uff09 *\/\r\n:nth-of-type(2n)   {}\r\n:nth-of-type(even) {}\r\n\r\n\/* 3\u5217\u30b0\u30ea\u30c3\u30c9\u306e\u4f4d\u7f6e\u5225\u6307\u5b9a *\/\r\n:nth-of-type(3n+1) {} \/* 1, 4, 7...\u5217\u76ee *\/\r\n:nth-of-type(3n+2) {} \/* 2, 5, 8...\u5217\u76ee *\/\r\n:nth-of-type(3n)   {} \/* 3, 6, 9...\u5217\u76ee *\/<\/code><\/pre>\r\n<blockquote>\r\n  <p><code>3n+1<\/code> \/ <code>3n+2<\/code> \/ <code>3n<\/code> \u306f\u300c3\u306e\u500d\u6570\u306e\u8981\u7d20\u300d\u3067\u306f\u306a\u304f\u30013\u3064\u3054\u3068\u306e\u30b0\u30eb\u30fc\u30d7\u306e\u5404\u4f4d\u7f6e\u3092\u6307\u3059\u3002<\/p>\r\n<\/blockquote>\r\n<h3 class=\"fz-ml\">\u5b9f\u7528\u4f8b\uff1aflex \u30ec\u30a4\u30a2\u30a6\u30c8\u306e\u4e0a\u30de\u30fc\u30b8\u30f3<\/h3>\r\n<p>\u5217\u6570\u306b\u5fdc\u3058\u305f\u6298\u308a\u8fd4\u3057\u5f8c\u306e\u4e0a\u30de\u30fc\u30b8\u30f3\u6307\u5b9a\u3002<code>:is()<\/code> \u3067\u30c7\u30fc\u30bf\u5c5e\u6027\u3092\u307e\u3068\u3081\u308b\u3053\u3068\u3067\u7e70\u308a\u8fd4\u3057\u3092\u6e1b\u3089\u305b\u308b\u3002<\/p>\r\n<pre><code class=\"language-css\">.shelf-wrapper:is([data-cols=\"2\"], [data-cols_pc=\"2\"]) &gt; :is(li, dd):nth-of-type(n+3),\r\n.shelf-wrapper:is([data-cols=\"3\"], [data-cols_pc=\"3\"]) &gt; :is(li, dd):nth-of-type(n+4),\r\n.shelf-wrapper:is([data-cols=\"4\"], [data-cols_pc=\"4\"]) &gt; :is(li, dd):nth-of-type(n+5) {\r\n  margin-top: 2pc;\r\n}<\/code><\/pre>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">3. :nth-child \u306e of \u69cb\u6587<\/h2>\r\n<p>Selectors Level 4 \u3067\u7b56\u5b9a\u3055\u308c\u305f\u69cb\u6587\u3002<code>:nth-child(An+B of \u30bb\u30ec\u30af\u30bf)<\/code> \u306e\u5f62\u3067\u3001\u7279\u5b9a\u306e\u30af\u30e9\u30b9\u3084\u72b6\u614b\u3092\u6301\u3064\u8981\u7d20\u3060\u3051\u3092\u5bfe\u8c61\u306b\u300c\u4f55\u756a\u76ee\u304b\u300d\u3092\u6570\u3048\u3089\u308c\u308b\u3002<\/p>\r\n<pre><code class=\"language-css\">:nth-child(An+B of \u30bb\u30ec\u30af\u30bf) {}<\/code><\/pre>\r\n<h3 class=\"fz-ml\">:nth-of-type \u3068\u306e\u9055\u3044<\/h3>\r\n<p><code>dl\/dt\/dd<\/code> \u304c\u6df7\u5728\u3057\u3001\u4e00\u90e8\u306e\u8981\u7d20\u3060\u3051\u306b <code>.christina<\/code> \u30af\u30e9\u30b9\u304c\u3064\u3044\u3066\u3044\u308b\u30b1\u30fc\u30b9\u3067\u6bd4\u8f03\u3059\u308b\u3002<\/p>\r\n<pre><code class=\"language-html\">\r\n  [1] list-term\r\n  [1] list-data\r\n  [2] list-term\r\n  [2] list-data\r\n  [3] list-term\r\n  [3] list-data\r\n<\/code><\/pre>\r\n<pre><code class=\"language-css\">\/* .christina:nth-of-type(1) \u2192 \u30bf\u30b0\u540d\u3054\u3068\u306b1\u756a\u76ee\u3092\u63a2\u3059\r\n   \u2192 dt \u306e 1\u756a\u76ee\u304b\u3064 .christina \u2192 [2] list-term\r\n   \u2192 dd \u306e 1\u756a\u76ee\u304b\u3064 .christina \u2192 [2] list-data\r\n   \u2192 2\u3064\u30d2\u30c3\u30c8 *\/\r\n.christina:nth-of-type(1) {}\r\n\r\n\/* :nth-child(1 of .christina) \u2192 .christina \u306e\u4e2d\u3067\u5144\u5f1f\u5168\u4f53\u304b\u30891\u756a\u76ee\r\n   \u2192 [2] list-term \u306e\u307f\u30d2\u30c3\u30c8 *\/\r\n:nth-child(1 of .christina) {}<\/code><\/pre>\r\n<blockquote>\r\n  <p><code>of<\/code> \u69cb\u6587\u306f <code>.christina<\/code> \u3092\u6301\u3064\u8981\u7d20\u3092\u4e00\u5217\u306b\u4e26\u3079\u76f4\u3057\u3066\u304b\u3089\u300c\u4f55\u756a\u76ee\u304b\u300d\u3092\u6570\u3048\u308b\u305f\u3081\u3001\u76f4\u611f\u901a\u308a\u306b\u52d5\u304f\u3002<\/p>\r\n<\/blockquote>\r\n<h3 class=\"fz-ml\">of \u69cb\u6587\u3067\u306e\u30af\u30e9\u30b9\u5185\u4f4d\u7f6e\u6307\u5b9a<\/h3>\r\n<pre><code class=\"language-html\">\r\n  [1] list-item\r\n  [2] list-item\r\n  [3] list-item\r\n  [4] list-item\r\n  [5] list-item\r\n  [6] list-item\r\n  [7] list-item\r\n<\/code><\/pre>\r\n<pre><code class=\"language-css\">\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u521d\u306e\u8981\u7d20 \u2192 [2] *\/\r\n:nth-child(1 of .christina) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u521d\u4ee5\u5916 \u2192 [4][5][6] *\/\r\n:nth-child(n+2 of .christina) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u5f8c\u306e\u8981\u7d20 \u2192 [6] *\/\r\n:nth-last-child(1 of .christina) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u5f8c\u4ee5\u5916 \u2192 [2][4][5] *\/\r\n:nth-last-child(n+2 of .christina) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u521d\u3068\u6700\u5f8c\u4ee5\u5916 \u2192 [4][5] *\/\r\n:nth-child(n+2 of .christina):nth-last-child(n+2 of .christina) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u30672\u756a\u76ee\uff5e3\u756a\u76ee \u2192 [4][5] *\/\r\n:nth-child(n+2 of .christina):nth-child(-n+3 of .christina) {}<\/code><\/pre>\r\n<h3 class=\"fz-ml\">of \u69cb\u6587\u304c\u771f\u4fa1\u3092\u767a\u63ee\u3059\u308b\u30b1\u30fc\u30b9<\/h3>\r\n<p><code>:nth-of-type<\/code> \u3067\u306f\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u300c\u7279\u5b9a\u306e\u72b6\u614b\u3092\u6301\u3064\u8981\u7d20\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u3066\u6570\u3048\u308b\u300d\u7528\u9014\u3002<\/p>\r\n<pre><code class=\"language-css\">\/* [type=\"hidden\"] \u3067\u306a\u3044\u8981\u7d20\u306e\u5947\u6570\u30fb\u5076\u6570\uff08\u30bc\u30d6\u30e9\u7e1e\uff09 *\/\r\n:nth-child(odd of :not([type=\"hidden\"])) {}\r\n:nth-child(even of :not([type=\"hidden\"])) {}\r\n\r\n\/* \u30c1\u30a7\u30c3\u30af\u6e08\u307f\u3092\u9664\u3044\u305f\u30ea\u30b9\u30c8\u306e\u6700\u521d *\/\r\n:nth-child(1 of li:not(.is-checked)) {}\r\n\r\n\/* \u753b\u50cf\u3042\u308a\u306e\u30ab\u30fc\u30c9\u3060\u3051\u6700\u521d\u3068\u6700\u5f8c\u4ee5\u5916 *\/\r\n:nth-child(n+2 of .card:has(img)):nth-last-child(n+2 of .card:has(img)) {}<\/code><\/pre>\r\n<blockquote>\r\n  <p><code>odd<\/code> \/ <code>even<\/code> \u306f <code>2n+1<\/code> \/ <code>2n<\/code> \u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3002<code>of<\/code> \u69cb\u6587\u3067\u3082\u4f7f\u3048\u308b\u3002<\/p>\r\n<\/blockquote>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">4. \u30af\u30e9\u30b9\u30d9\u30fc\u30b9\u306e\u4f4d\u7f6e\u9078\u629e\uff1a:is() \/ :not() \/ :has()<\/h2>\r\n<p>\u300c\u524d\u5f8c\u306e\u8981\u7d20\u3068\u306e\u95a2\u4fc2\u3067\u4f4d\u7f6e\u3092\u6307\u5b9a\u3059\u308b\u300d\u7528\u9014\u306f <code>of<\/code> \u69cb\u6587\u3067\u306f\u306a\u304f\u3001<code>:has()<\/code> \/ <code>:is()<\/code> \/ <code>:not()<\/code> \u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u66f8\u304f\u3002<\/p>\r\n<pre><code class=\"language-html\">\r\n  [1] list-item\r\n  [2] list-item\r\n  [3] list-item\r\n  [4] list-item\r\n  [5] list-item\r\n  [6] list-item\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u96a3\u63a5\u30fb\u9593\u63a5\u95a2\u4fc2\u306e\u6307\u5b9a<\/h3>\r\n<pre><code class=\"language-css\">\/* .christina \u3092\u6301\u305f\u306a\u3044 .target *\/\r\n.target:not(.christina) {}\r\n\r\n\/* .christina \u306e\u5b50\u5b6b\u3067\u306f\u306a\u3044 .target *\/\r\n.target:not(.christina *) {}\r\n\r\n\/* .christina \u3092\u6301\u305f\u305a\u3001\u304b\u3064\u5b50\u5b6b\u3067\u3082\u306a\u3044 .target *\/\r\n.target:not(.christina, .christina *) {}\r\n\r\n\/* .christina \u306e\u76f4\u5f8c\u306e\u8981\u7d20 \u2192 [3] *\/\r\n.target:is(.christina + *) {}\r\n\r\n\/* .christina \u306e\u5f8c\u308d\u306b\u3042\u308b\u3059\u3079\u3066\u306e\u8981\u7d20 \u2192 [3][4][5][6] *\/\r\n.target:is(.christina ~ *) {}\r\n\r\n\/* .christina \u306e\u76f4\u524d\u306e\u8981\u7d20 \u2192 [1][3] *\/\r\n.target:has(+ .christina) {}\r\n\r\n\/* .christina \u3088\u308a\u524d\u306b\u3042\u308b\u3059\u3079\u3066\u306e\u8981\u7d20 \u2192 [1][3] *\/\r\n.target:has(~ .christina) {}<\/code><\/pre>\r\n<h3 class=\"fz-ml\">.christina \u30af\u30e9\u30b9\u3092\u6301\u3064\u8981\u7d20\u306e\u4e2d\u3067\u306e\u4f4d\u7f6e<\/h3>\r\n<pre><code class=\"language-css\">\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u521d\u306e\u8981\u7d20 \u2192 [2] *\/\r\n.christina:not(.christina ~ *) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u521d\u4ee5\u5916 \u2192 [4][5] *\/\r\n.christina:is(.christina ~ *) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u5f8c\u306e\u8981\u7d20 \u2192 [5] *\/\r\n.christina:not(:has(~ .christina)) {}\r\n\r\n\/* .christina \u3092\u6301\u3064\u4e2d\u3067\u6700\u5f8c\u4ee5\u5916 \u2192 [2][4] *\/\r\n.christina:has(~ .christina) {}<\/code><\/pre>\r\n<blockquote>\r\n  <p><code>:has(~ .christina)<\/code> \u306f\u300c\u5f8c\u308d\u306e\u3069\u3053\u304b\u306b <code>.christina<\/code> \u304c\u3042\u308b\u300d\u2192 \u6700\u5f8c\u4ee5\u5916\u3002<br \/>\r\n    <code>:not(:has(~ .christina))<\/code> \u306f\u300c\u5f8c\u308d\u306b <code>.christina<\/code> \u304c\u306a\u3044\u300d\u2192 \u6700\u5f8c\u306e\u8981\u7d20\u3002\u76f4\u611f\u3068\u9006\u306b\u306a\u308a\u3084\u3059\u3044\u306e\u3067\u6ce8\u610f\u3002\r\n  <\/p>\r\n<\/blockquote>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">5. of \u69cb\u6587 vs :has()\/:is()\/:not() \u306e\u4f7f\u3044\u5206\u3051<\/h2>\r\n<table class=\"table my-0.5r\">\r\n  <thead>\r\n    <tr class=\"rung\">\r\n      <th>\u7528\u9014<\/th>\r\n      <td>\u5411\u3044\u3066\u3044\u308b\u69cb\u6587<\/td>\r\n    <\/tr>\r\n  <\/thead>\r\n  <tbody>\r\n    <tr class=\"rung\">\r\n      <th>\u30af\u30e9\u30b9\u3084\u72b6\u614b\u3067\u30d5\u30a3\u30eb\u30bf\u3057\u3066\u300c\u4f55\u756a\u76ee\u304b\u300d\u3092\u6307\u5b9a<\/th>\r\n      <td><code>of<\/code> \u69cb\u6587<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th>\u975e\u8868\u793a\u30fb\u30c1\u30a7\u30c3\u30af\u6e08\u307f\u306a\u3069\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u3066\u6570\u3048\u308b<\/th>\r\n      <td><code>of<\/code> \u69cb\u6587<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th>\u524d\u5f8c\u306e\u8981\u7d20\u3068\u306e\u76f8\u5bfe\u7684\u306a\u4f4d\u7f6e\u95a2\u4fc2\u3067\u6307\u5b9a<\/th>\r\n      <td><code>:has()<\/code> \/ <code>:is()<\/code> \/ <code>:not()<\/code><\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th>\u8a73\u7d30\u5ea6\u3092\u30bc\u30ed\u306b\u6291\u3048\u305f\u3044<\/th>\r\n      <td><code>:where()<\/code><\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">6. \u300c\u6700\u521d\u4ee5\u5916\u300d\u306e\u8907\u6570\u306e\u66f8\u304d\u65b9\u3068\u8a73\u7d30\u5ea6<\/h2>\r\n<p>\u540c\u3058\u610f\u5473\u306e\u30bb\u30ec\u30af\u30bf\u3067\u3082\u66f8\u304d\u65b9\u306b\u3088\u3063\u3066\u8a73\u7d30\u5ea6\u3084\u5909\u66f4\u30b3\u30b9\u30c8\u304c\u5909\u308f\u308b\u3002<\/p>\r\n<pre><code class=\"language-css\">\/* \u6700\u521d\u4ee5\u5916 *\/\r\n.target:not(:first-of-type)  {} \/* \u8a73\u7d30\u5ea6: 0,2,0 *\/\r\n.target:nth-of-type(n+2)     {} \/* \u8a73\u7d30\u5ea6: 0,2,0 *\/\r\n\r\n\/* \u6700\u521d\u3068\u6700\u5f8c\u4ee5\u5916 *\/\r\n.target + .target                        {} \/* \u8a73\u7d30\u5ea6: 0,2,0\uff08\u30d5\u30af\u30ed\u30a6\u30bb\u30ec\u30af\u30bf\uff09 *\/\r\n:nth-of-type(n+2):nth-last-of-type(n+2) {} \/* \u8a73\u7d30\u5ea6: 0,2,0 *\/<\/code><\/pre>\r\n<p>\u300c\u6700\u521d\u3068\u6700\u5f8c\u4ee5\u5916\u300d\u3092\u300c\u6700\u521d\u304b\u30893\u756a\u76ee\u306e\u5f8c\u3068\u6700\u5f8c\u304b\u30893\u756a\u76ee\u3088\u308a\u524d\u4ee5\u5916\u300d\u306b\u5909\u66f4\u3057\u305f\u304f\u306a\u3063\u305f\u5834\u5408\u3001\u30d5\u30af\u30ed\u30a6\u30bb\u30ec\u30af\u30bf <code>.target + .target<\/code> \u306f\u66f8\u304d\u63db\u3048\u304c\u5927\u304d\u3044\u3002\u6700\u521d\u304b\u3089 <code>:nth-of-type(n+2):nth-last-of-type(n+2)<\/code> \u306e\u5f62\u3067\u66f8\u3044\u3066\u304a\u304f\u3068\u5909\u66f4\u304c\u5c40\u6240\u7684\u306b\u6e08\u3080\u3002<\/p>\r\n<p><code>:where()<\/code> \u3092\u4f7f\u3046\u3068\u8a73\u7d30\u5ea6\u3092\u30bc\u30ed\u306b\u3067\u304d\u308b\u305f\u3081\u3001\u4e0a\u66f8\u304d\u3057\u3084\u3059\u3044\u30b9\u30bf\u30a4\u30eb\u3092\u66f8\u304d\u305f\u3044\u5834\u9762\u3067\u6709\u52b9\u3002<\/p>\r\n<pre><code class=\"language-css\">\/* \u8a73\u7d30\u5ea6\u3092\u30bc\u30ed\u306b\u3059\u308b *\/\r\n.christina:where(:has(~ .christina)) {} \/* \u6700\u5f8c\u4ee5\u5916\u3001\u8a73\u7d30\u5ea6: 0,1,0 *\/<\/code><\/pre>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\">7. \u8a73\u7d30\u5ea6\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/h2>\r\n<table class=\"table my-0.5r\">\r\n  <thead>\r\n    <tr class=\"rung\">\r\n      <th>\u30bb\u30ec\u30af\u30bf<\/th>\r\n      <td>\u8a73\u7d30\u5ea6<\/td>\r\n    <\/tr>\r\n  <\/thead>\r\n  <tbody>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-of-type(n+2)<\/code><\/th>\r\n      <td>0,1,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-of-type(n+4):nth-of-type(-n+6)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-last-of-type(n+2)<\/code><\/th>\r\n      <td>0,1,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-last-of-type(n+4):nth-last-of-type(-n+6)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-of-type(n+2):nth-last-of-type(n+2)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-of-type(odd)<\/code><\/th>\r\n      <td>0,1,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-child(1 of .christina)<\/code><\/th>\r\n      <td>0,1,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>:nth-child(n+2 of .christina):nth-last-child(n+2 of .christina)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.target:not(:first-of-type)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.target:nth-of-type(n+2)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.target + .target<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.christina:not(.christina ~ *)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.christina:is(.christina ~ *)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.christina:not(:has(~ .christina))<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>.christina:has(~ .christina)<\/code><\/th>\r\n      <td>0,2,0<\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\r\n<blockquote>\r\n  <p><code>:is()<\/code> \/ <code>:not()<\/code> \u306e\u8a73\u7d30\u5ea6\u306f\u5f15\u6570\u30ea\u30b9\u30c8\u306e\u4e2d\u3067\u6700\u3082\u9ad8\u3044\u8a73\u7d30\u5ea6\u3092\u5f15\u304d\u7d99\u3050\u3002<br \/>\r\n    <code>of<\/code> \u69cb\u6587\u306e\u8a73\u7d30\u5ea6\u306f <code>of<\/code> \u4ee5\u964d\u306e\u30bb\u30ec\u30af\u30bf\u306e\u8a73\u7d30\u5ea6\u3092\u5f15\u304d\u7d99\u3050\uff08<code>:nth-child(1 of .christina)<\/code> \u306f <code>0,1,0<\/code>\uff09\u3002<br \/>\r\n    <code>:where()<\/code> \u3092\u4f7f\u3046\u3068\u8a73\u7d30\u5ea6\u3092\u30bc\u30ed\u306b\u3067\u304d\u308b\u3002\r\n  <\/p>\r\n<\/blockquote>","protected":false},"excerpt":{"rendered":"\uff1anth-of-type\u30fb:nth-last-of-type \u306e\u5f0f\u306e\u8aad\u307f\u65b9\u304b\u3089\u3001:is() \/ :not() \/ :has() \u3092\u4f7f\u3063\u305f\u30af\u30e9\u30b9\u30d9\u30fc\u30b9\u4f4d\u7f6e\u9078\u629e\u307e\u3067\u7db2\u7f85\u3002\u300c\u6700\u521d\u3068\u6700\u5f8c\u4ee5\u5916\u300d\u306e\u8907\u6570\u306e\u66f8\u304d\u65b9\u3068\u8a73\u7d30\u5ea6\u306e\u6bd4\u8f03\u3082\u53ce\u9332\u3002CSS\u8a2d\u8a08\u306e\u5b9f\u52d9\u306b\u5f79\u7acb\u3064\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9","protected":false},"author":1,"featured_media":12967,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","footnotes":"","vk-ltc-link":"","vk-ltc-target":"0"},"categories":[11],"tags":[977,982,974,975,976,978,979,980,981,350,200,130],"class_list":["post-12913","post","type-post","status-publish","format-standard","has-post-thumbnail","category-html-css","tag-nth-last-of-type","tag-982","tag-974","tag-nth-of-type","tag-nth-child","tag-has","tag-is","tag-not","tag-981","tag-350","tag-200","tag-css"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/12913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=12913"}],"version-history":[{"count":10,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/12913\/revisions"}],"predecessor-version":[{"id":13205,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/12913\/revisions\/13205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/12967"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=12913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=12913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=12913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}