From 56b34e61d9c06614029fc69f3c1fdd4da3c73f71 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Mon, 3 Jan 2022 12:29:17 +0900 Subject: 2021/08/13 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/_doublecolon_part/index.md | 123 +++++++++++++--------------- 1 file changed, 55 insertions(+), 68 deletions(-) (limited to 'files/ja/web') diff --git a/files/ja/web/css/_doublecolon_part/index.md b/files/ja/web/css/_doublecolon_part/index.md index dc56b9e9b9..85d2b707fd 100644 --- a/files/ja/web/css/_doublecolon_part/index.md +++ b/files/ja/web/css/_doublecolon_part/index.md @@ -1,39 +1,40 @@ --- title: '::part()' -slug: 'Web/CSS/::part' +slug: Web/CSS/::part tags: - '::part' - CSS - Draft - - Experimental + - 実験的 - NeedsBrowserCompatibility - NeedsExample - - Pseudo-element - - Reference - - Selector - - セレクター - 擬似要素 -translation_of: 'Web/CSS/::part' + - リファレンス + - セレクター +browser-compat: css.selectors.part +translation_of: Web/CSS/::part --- -
{{CSSRef}}
+{{CSSRef}} -

::partCSS擬似要素で、一致する {{HTMLAttrxRef("part")}} 属性を持つシャドウツリー内の要素を表します。

+**`::part`** は [CSS](/ja/docs/Web/CSS) の[擬似要素](/ja/docs/Web/CSS/Pseudo-elements)で、一致する {{HTMLAttrxRef("part")}} 属性を持つ[シャドウツリー](/ja/docs/Web/Web_Components/Using_shadow_DOM)内の要素を表します。 -
custom-element::part(foo) {
-  /* Styles to apply to the `foo` part */
+```css
+custom-element::part(foo) {
+  /* `foo` の部分に適用するスタイル */
 }
-
+``` -

構文

+## 構文 {{CSSSyntax}} -

+## 例 -

HTML

+### HTML -
<template id="tabbed-custom-element">
-<style type="text/css">
+```html
+
 
-<tabbed-custom-element></tabbed-custom-element>
+ +``` -

CSS

+### CSS -
tabbed-custom-element::part(tab) {
-  color: #0c0c0dcc;
+```css
+tabbed-custom-element::part(tab) {
+  color: #0c0dcc;
   border-bottom: transparent solid 2px;
 }
 
 tabbed-custom-element::part(tab):hover {
-  background-color: #0c0c0d19;
-  border-color: #0c0c0d33;
+  background-color: #0c0d19;
+  border-color: #0c0d33;
 }
 
 tabbed-custom-element::part(tab):hover:active {
-  background-color: #0c0c0d33;
+  background-color: #0c0d33;
 }
 
 tabbed-custom-element::part(tab):focus {
@@ -76,11 +79,12 @@ tabbed-custom-element::part(active) {
   color: #0060df;
   border-color: #0a84ff !important;
 }
-
+``` -

JavaScript

+### JavaScript -
let template = document.querySelector("#tabbed-custom-element");
+```js
+let template = document.querySelector("#tabbed-custom-element");
 globalThis.customElements.define(template.id, class extends HTMLElement {
   constructor() {
     super();
@@ -88,39 +92,22 @@ globalThis.customElements.define(template.id, class extends HTMLElement {
     this.shadowRoot.appendChild(template.content);
   }
 });
-
- -

結果

- -

{{EmbedLiveSample('Examples')}}

- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName("CSS Shadow Parts", "#part", "::part")}}{{Spec2("CSS Shadow Parts")}}初回定義
- -

ブラウザーの互換性

- -

{{Compat("css.selectors.part")}}

- -

関連情報

- - +``` + +### 結果 + +{{EmbedLiveSample('Examples')}} + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{HTMLAttrxRef("part")}} 属性 - `::part()` セレクタで選択できるパーツを定義するために使用されます +- {{HTMLAttrxRef("exportparts")}} 属性 - ネストされたシャドウツリーにシャドウパーツを推移的にエクスポートするために使用されます。 +- [Explainer: CSS Shadow ::part and ::theme](https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md) -- cgit v1.2.3-54-g00ecf