Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Created January 4, 2026 14:33
Show Gist options
  • Select an option

  • Save kobitoDevelopment/6bf568b27fad67583027e45e128fa49f to your computer and use it in GitHub Desktop.

Select an option

Save kobitoDevelopment/6bf568b27fad67583027e45e128fa49f to your computer and use it in GitHub Desktop.
/* @layer宣言の外で記述されているスタイル */
.text {
color: red !important;
font-size: 1rem !important;
text-align: start !important;
text-decoration: underline double !important;
margin-top: 400px !important;
}
.text {
/* .textの直前のレイヤーは@layer宣言の外になるため、上述のスタイルが全て取り消される
* これをrevertにしてしまうとlayerの関係を無視して全てをrevertでimportantにしてしまうため、以下記述が適用されない。
*/
all: revert-layer !important;
/* @layer宣言の中で記述されているスタイルのみ適用される */
@layer {
color: blue;
font-size: 2rem;
text-align: center;
text-decoration: underline wavy;
}
}
<p class="text">テキスト</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment