{"id":2365,"date":"2025-07-16T04:02:55","date_gmt":"2025-07-16T04:02:55","guid":{"rendered":"https:\/\/satokotadesign.com\/blog\/?p=2365"},"modified":"2025-07-16T04:02:55","modified_gmt":"2025-07-16T04:02:55","slug":"css_part_slotted","status":"publish","type":"post","link":"https:\/\/satokotadesign.com\/blog\/css_part_slotted\/","title":{"rendered":"\u30b7\u30e3\u30c9\u30fcDOM\u3067\u3082\u81ea\u5728\u306bCSS\uff01Web\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u62e1\u5f35\u3059\u308b ::part \u3068 ::slotted \u306e\u4f7f\u3044\u65b9\u30ac\u30a4\u30c9"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067WEB\u30c7\u30b6\u30a4\u30ca\u30fc\u3092\u3057\u3066\u3044\u307e\u3059\u5c0f\u7027\u3067\u3059\u3002<br \/>\n<span class=\"sc_marker-animation\">Web\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08Custom Elements\uff09<\/span>\u3092\u4f7f\u3046\u6a5f\u4f1a\u304c\u5897\u3048\u3066\u304d\u305f\u4eca\u65e5\u3053\u306e\u9803\u3002<br \/>\n\u305d\u306e\u4fbf\u5229\u3055\u306b\u60f9\u304b\u308c\u308b\u4e00\u65b9\u3067\u3001<span class=\"sc_marker-animation\">\u300cCSS\u3067\u30b9\u30bf\u30a4\u30eb\u3092\u5f53\u3066\u3089\u308c\u306a\u3044\u2026\u300d<\/span>\u3068\u60a9\u3093\u3060\u3053\u3068\u3001\u3042\u308a\u307e\u305b\u3093\u304b\uff1f<\/p>\n<p>\u3053\u308c\u306f\u30b7\u30e3\u30c9\u30fcDOM\u3068\u3044\u3046\u201c\u5916\u304b\u3089\u89e6\u308c\u306a\u3044\u30ab\u30d7\u30bb\u30eb\u201d\u306e\u305b\u3044\u3002<br \/>\n\u3067\u3082\u5927\u4e08\u592b\u3002<br \/>\nCSS\u306b\u306f <span class=\"fontbackground\" style=\"background:;\">::part<\/span> \u3068 <span class=\"fontbackground\" style=\"background:;\">::slotted<\/span> \u3068\u3044\u3046\u3001<span class=\"sc_marker-animation\">\u201c\u30ab\u30d7\u30bb\u30eb\u8d8a\u3057\u306b\u30b9\u30bf\u30a4\u30eb\u3092\u4f1d\u3048\u308b\u7a93\u53e3\u201d<\/span>\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3093\u3067\u3059\uff01<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u305d\u306e\u4f7f\u3044\u65b9\u3068\u4f7f\u3044\u5206\u3051\u3001\u5b9f\u7528\u4f8b\u3092\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u30b7\u30e3\u30c9\u30fcDOM\u306e\u30b9\u30bf\u30a4\u30eb\u306e\u58c1\u3068\u306f\uff1f<\/span><\/h2>\n<p>Web\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u306f\u3001HTML\u8981\u7d20\u306e\u4e2d\u306bshadowRoot\uff08\u30b7\u30e3\u30c9\u30fcDOM\uff09\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u3067\u3001<br \/>\n<span class=\"sc_marker-animation\">\u5916\u90e8CSS\u306e\u5f71\u97ff\u3092\u5b8c\u5168\u306b\u906e\u65ad\u3059\u308b\u72ec\u7acb\u7a7a\u9593\u304c\u751f\u307e\u308c\u307e\u3059\u3002<\/span><\/p>\n<p>\u305f\u3068\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ab\u30b9\u30bf\u30e0\u8981\u7d20<\/p>\n<pre class=\"line-numbers\"><code class=\"language-html\"> &lt;my-button&gt;Click me!&lt;\/my-button&gt; <\/code><\/pre>\n<p>\u3053\u306e\u4e2d\u306e\u30dc\u30bf\u30f3\u3092\u30b7\u30e3\u30c9\u30fcDOM\u306b\u9589\u3058\u8fbc\u3081\u3066\u3057\u307e\u3046\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u5916\u90e8CSS\u306f\u52b9\u304d\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"line-numbers\" ><code class=\"language-css\">button { \r\n\u3000color: red;\r\n }<\/code><\/pre>\n<p>\u305d\u3093\u306a\u3068\u304d\u306e\u305f\u3081\u306b\u5c0e\u5165\u3055\u308c\u305f\u306e\u304c\u6b21\u306e2\u3064<\/p>\n<div class=\"sc_designlist ul fa_check blue\">\n<ul>\n<li><strong>::part<\/strong>\uff1a\u30b7\u30e3\u30c9\u30fcDOM\u5185\u306e<span class=\"sc_marker-animation\">\u516c\u958b\u3057\u305f\u3044\u30d1\u30fc\u30c4\u306b\u3060\u3051CSS<\/span>\u3092\u6e21\u3059<\/li>\n<li><strong>::slotted<\/strong>\uff1a\u30e6\u30fc\u30b6\u30fc\u304c &lt;slot&gt; \u3092\u4f7f\u3063\u3066\u633f\u5165\u3057\u305f\u5916\u90e8\u8981\u7d20\u306bCSS\u3092\u6e21\u3059<\/li>\n<\/ul>\n<\/div>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">::part\uff1a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5185\u306e\u30d1\u30fc\u30c4\u3092\u516c\u958b<\/span><\/h2>\n<h3 class=\"sc_heading bborder b blue\"><span class=\"sc_title\">\u4f7f\u3044\u65b9\u306e\u57fa\u672c<\/span><\/h3>\n<p>\u30b7\u30e3\u30c9\u30fcDOM\u5185\u306e\u8981\u7d20\u306b<span class=\"fontbackground\" style=\"background:;\"> part <\/span>\u5c5e\u6027\u3092\u4ed8\u3051\u3066\u304a\u304f\u3068\u3001<br \/>\n<span class=\"sc_marker-animation\">\u5916\u90e8\u304b\u3089\u305d\u306e\u90e8\u5206\u3060\u3051\u306b\u30b9\u30bf\u30a4\u30eb\u3092\u5f53\u3066\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<h4>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u4e2d\uff08JavaScript\u5074\uff09<\/h4>\n<pre class=\"line-numbers\"><code class=\"language-html\"> &lt;button part=\"base\"&gt;Click me&lt;\/button&gt; <\/code><\/pre>\n<h4>\u5916\u90e8CSS<\/h4>\n<pre class=\"line-numbers\"><code class=\"language-css\">my-button::part(base) { \r\nbackground-color: royalblue; \r\ncolor: white; \r\n} <\/code><\/pre>\n<p>\u3053\u308c\u3067\u3001<span class=\"fontbackground\" style=\"background:;\">my-button<\/span>\u306e\u5185\u90e8\u30dc\u30bf\u30f3\u306b\u3060\u3051CSS\u304c\u5c4a\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u308b\u3067 <span class=\"fontbackground\" style=\"background:;\">scoped<\/span> \u306aCSS\u306e\u7a74\u3092\u3042\u3051\u308b\u3088\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u306d\u3002<\/p>\n<h3 class=\"sc_heading bborder b blue\"><span class=\"sc_title\">\u8907\u6570\u30d1\u30fc\u30c4\u306e\u6307\u5b9a\u3082\u53ef\u80fd<\/span><\/h3>\n<pre class=\"line-numbers\"><code class=\"language-html\"> &lt;div part=\"header content footer\"&gt; ... &lt;\/div&gt; <\/code><\/pre>\n<p>\u5916\u90e8\u3067\u306f\u305d\u308c\u305e\u308c\u306e<span class=\"fontbackground\" style=\"background:;\"> ::part(header) <\/span>\u306a\u3069\u306b\u30b9\u30bf\u30a4\u30eb\u3092\u5f53\u3066\u3089\u308c\u307e\u3059\u3002<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">::slotted\uff1a\u30e6\u30fc\u30b6\u30fc\u304c\u633f\u5165\u3057\u305f\u8981\u7d20\u306b\u30b9\u30bf\u30a4\u30eb<\/span><\/h2>\n<p>\u4e00\u65b9\u3067\u3001<span class=\"fontbackground\" style=\"background:;\">slot<\/span> \u306b\u5dee\u3057\u8fbc\u307e\u308c\u305f \u5916\u90e8\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u8981\u7d20\u306b\u30b9\u30bf\u30a4\u30eb\u3092\u9069\u7528\u3057\u305f\u3044\u5834\u5408\u306f<span class=\"fontbackground\" style=\"background:;\"> ::slotted <\/span>\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h3 class=\"sc_heading bborder b blue\"><span class=\"sc_title\">\u30b9\u30ed\u30c3\u30c8\u4f8b<\/span><\/h3>\n<h4>\u30b7\u30e3\u30c9\u30fcDOM\u5185\u306eHTML<\/h4>\n<pre class=\"line-numbers\"><code class=\"language-html\"> &lt;slot name=\"text\"&gt;&lt;\/slot&gt; <\/code><\/pre>\n<h4>\u4f7f\u7528\u8005\u5074<\/h4>\n<pre class=\"line-numbers\"><code class=\"language-html\"> &lt;my-card&gt; &lt;p slot=\"text\"&gt;\u5dee\u3057\u8fbc\u307e\u308c\u305f\u30c6\u30ad\u30b9\u30c8&lt;\/p&gt; &lt;\/my-card&gt; <\/code><\/pre>\n<h4>\u30b9\u30bf\u30a4\u30eb<\/h4>\n<pre class=\"line-numbers\"><code class=\"language-css\"> ::slotted(p[slot=\"text\"]) { font-weight: bold; color: crimson; } <\/code><\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30b9\u30ed\u30c3\u30c8\u306b\u5dee\u3057\u8fbc\u307e\u308c\u305f\u8981\u7d20\u306b\u3060\u3051\u30d4\u30f3\u30dd\u30a4\u30f3\u30c8\u3067\u30b9\u30bf\u30a4\u30eb\u304c\u5c4a\u304f\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">::part \u3068 ::slotted \u306e\u9055\u3044\u307e\u3068\u3081<\/span><\/h2>\n<div class=\"diver_review_table\">\n<table>\n<tr>\n<th>::part<\/th>\n<td class=\"table_harf\">\u30bf\u30fc\u30b2\u30c3\u30c8\uff1a\u30b7\u30e3\u30c9\u30fcDOM\u5185\u306e\u8981\u7d20<br \/>\n\u5ba3\u8a00\u5834\u6240\uff1a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5185\u3067 part=\"\" \u3092\u4ed8\u3051\u308b<br \/>\n\u5916\u90e8CSS\u304b\u3089\u306e\u6307\u5b9a\uff1a::part(\u540d\u524d)<br \/>\n\u8a73\u7d30\u6307\u5b9a\uff1a\u53ef\u80fd\uff08\u64ec\u4f3c\u8981\u7d20\u3001class\u306a\u3069\u4f75\u7528OK\uff09\n<\/td>\n<th>::slotted<\/th>\n<td class=\"table_harf\">\u30bf\u30fc\u30b2\u30c3\u30c8\uff1a\u30b7\u30e3\u30c9\u30fcDOM\u306b\u5dee\u3057\u8fbc\u307e\u308c\u305f\u5916\u90e8\u8981\u7d20<br \/>\n\u5ba3\u8a00\u5834\u6240\uff1a<slot> \u30bf\u30b0\u3068\u30b9\u30ed\u30c3\u30c8\u5c5e\u6027\u3067\u7ba1\u7406<br \/>\n\u5916\u90e8CSS\u304b\u3089\u306e\u6307\u5b9a\uff1a::slotted(\u30bb\u30ec\u30af\u30bf)<br \/>\n\u8a73\u7d30\u6307\u5b9a\uff1a\u30bb\u30ec\u30af\u30bf\u306f\u7b2c\u4e00\u968e\u5c64\u307e\u3067\uff08\u76f4\u63a5\u306e\u5b50\u306e\u307f\uff09<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>&nbsp;<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u307e\u3068\u3081<\/span><\/h2>\n<p>CSS \u306e<span class=\"fontbackground\" style=\"background:;\"> ::part <\/span>\u3068<span class=\"fontbackground\" style=\"background:;\"> ::slotted <\/span>\u306f\u3001Web\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u201c\u5bc6\u9589\u6027\u201d\u3092\u58ca\u3055\u305a\u306b\u30b9\u30bf\u30a4\u30eb\u306e\u67d4\u8edf\u6027\u3092\u4fdd\u3064\u305f\u3081\u306e\u30ad\u30fc\u6280\u8853\u3067\u3059\u3002<\/p>\n<div class=\"sc_designlist ol radius solid blue\">\n<ol>\n<li>\u30ab\u30d7\u30bb\u30eb\u5316\u3057\u306a\u304c\u3089\u3082\u62e1\u5f35\u53ef\u80fd\u306a\u30c7\u30b6\u30a4\u30f3\u304c\u3067\u304d\u308b<\/li>\n<li>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u518d\u5229\u7528\u6027\u3068\u30c6\u30fc\u30de\u5bfe\u5fdc\u3092\u4e21\u7acb\u3067\u304d\u308b<\/li>\n<li>\u69cb\u9020\u306e\u610f\u56f3\u3092\u4fdd\u3063\u305f\u307e\u307eCSS\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u53ef\u80fd\u306b\u306a\u308b<\/li>\n<\/ol>\n<\/div>\n<p><span class=\"sc_marker-animation\">\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5316\u304c\u9032\u3080\u4eca\u5f8c\u306eWeb\u5236\u4f5c\u306b\u304a\u3044\u3066\u306f\u3001\u5fc5\u4fee\u30b9\u30ad\u30eb\u306b\u306a\u308b\u3053\u3068\u9593\u9055\u3044\u306a\u3057\uff01<\/span><br \/>\n\u5b9f\u52d9\u3067\u3082\u3001UI\u30e9\u30a4\u30d6\u30e9\u30ea\u5236\u4f5c\u3067\u3082\u3001\u4eca\u304b\u3089\u4f7f\u3063\u3066\u304a\u3044\u3066\u640d\u306f\u3042\u308a\u307e\u305b\u3093\u3088\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_475\" aria-describedby=\"caption-attachment-475\" style=\"width: 1500px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/satokotadesign.com\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr.jpg\" alt=\"\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u5236\u4f5c\u306a\u3089satokotadesign\" width=\"1500\" height=\"500\" class=\"size-full wp-image-475\" srcset=\"https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr.jpg 1500w, https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr-500x167.jpg 500w, https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr-1024x341.jpg 1024w, https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr-768x256.jpg 768w\" sizes=\"auto, (max-width: 1500px) 100vw, 1500px\" \/><\/a><figcaption id=\"caption-attachment-475\" class=\"wp-caption-text\"><a href=\"https:\/\/satokotadesign.com\/contact\/\" target=\"_blank\" rel=\"noopener\">\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u5236\u4f5c\u306a\u3089satokotadesign<\/a><\/figcaption><\/figure><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067WEB\u30c7\u30b6\u30a4\u30ca\u30fc\u3092\u3057\u3066\u3044\u307e\u3059\u5c0f\u7027\u3067\u3059\u3002 Web\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08Custom Elements\uff09\u3092\u4f7f\u3046\u6a5f\u4f1a\u304c\u5897\u3048\u3066\u304d\u305f\u4eca\u65e5\u3053\u306e\u9803\u3002 \u305d\u306e\u4fbf\u5229\u3055\u306b\u60f9\u304b\u308c\u308b\u4e00\u65b9\u3067\u3001\u300cCSS\u3067\u30b9\u30bf\u30a4\u30eb\u3092\u5f53\u3066\u3089\u308c\u306a\u3044\u2026\u300d\u3068\u60a9\u3093\u3060\u3053\u3068\u3001\u3042\u308a\u307e\u2026<\/p>\n","protected":false},"author":1,"featured_media":2369,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[9],"class_list":["post-2365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web","tag-css"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts\/2365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/comments?post=2365"}],"version-history":[{"count":6,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts\/2365\/revisions"}],"predecessor-version":[{"id":2372,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts\/2365\/revisions\/2372"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/media\/2369"}],"wp:attachment":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/media?parent=2365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/categories?post=2365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/tags?post=2365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}