Skip to content

day5 #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

day5 #188

wants to merge 2 commits into from

Conversation

sakupi01
Copy link
Owner

@Jxck
Day5 の記事を執筆しました。お手隙でレビューいただけると幸いです!

Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blog.sakupi01.com ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 12, 2025 0:15am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
git-kusa ⬜️ Skipped (Inspect) Jul 12, 2025 0:15am

@sakupi01 sakupi01 force-pushed the feat/2025-advent-5 branch from 751218b to 2252a90 Compare July 11, 2025 16:46
@vercel vercel bot temporarily deployed to Preview – git-kusa July 11, 2025 16:46 Inactive
Copy link

cloudflare-workers-and-pages bot commented Jul 11, 2025

Deploying studiosakupi01com with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0aa0507
Status: ✅  Deploy successful!
Preview URL: https://457966f6.studiosakupi01com.pages.dev
Branch Preview URL: https://feat-2025-advent-5.studiosakupi01com.pages.dev

View logs


## The Cascade

「単一のスタイルシートがプレゼンテーションに「Influence」すること以上に、「複数のスタイルシートが相互に影響して「Influence」するために、なぜ『Cascade』という方法論である必要があるのか」ということを、CSS の仕様では、**「Modularity」** と **「Balance」** に分けて説明しています。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この長さで の入れ子だと、構造がぱっとよくわからん。
Influence, Cascade, Modularity, Balance は " でよいし、かっこはネストしない方が良さそう。

「User `!important` が Author `!important` よりも優先される」という定義は、CSS の最初から存在していたわけではなく、CSS1 最初の提案から約 3 年後に変更されたものです。

仕様にもある通り、これは単なる仕様変更ではなく、**「a semantic change」**と明記されています。
Author `!important` が User `!important` よりも優先されるという、**常に Author の権限が大きかった** 時代から、**User の権限が大きくなる** 可能性を持てるようになりました。**「a balance of power」**が User と Author の間で取れるようになったのです。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

強調が多すぎる気がしなくもない。


こうした背景を踏まえると、`!important` が Cascade においてどういう意味を持つべきとされているのかが見えてきます。

もちろん、`!important` を用いれば、同一オリジン間での優先度を上げることもでき、そういった使い方をすることもできます。例えば、拡張機能など、いかなる状況でも詳細度を上げなければどうしようもない局面においては、`!important` を用いて「最大限の影響力」を表現をするのは仕方がありません。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同一オリジン間での優先度を上げることもでき、そういった使い方をすることもできます

前と後ろで言ってることが同じで、正規化すると後ろいらなくなる。

同一オリジンで優先度をあげることもできます。

もしくは、「そうも使える」を強調したいなら、

!important を用いれば、同一オリジン間での優先度を上げるような使い方もできます`

とか。
こういう書き方、けっこう癖だと思う。


それゆえ、例えば Author から `!important` を用いて User の non-`!important` なスタイルを上書きすることは、本来 `!important` が「守り」の手段であることに反し、「攻め」の手段として不本意な使われ方をしていることになります。

`!important` を用いて、何かを「上書き」する場合は、仕様の想定に反した使い方をしている可能性があることを、ぜひ念頭に置いておきたいものです。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「そういう使い方は想定じゃないからするな」はわかるけど、でも現実には使われている。
であれば

  • じゃあなんで important は想定じゃない使い方をされてしまっているのか
  • それはどうやって(important を使わずに)解決すべきなのか

みたいな部分がなければ、ただの原理主義説教になっちゃうと思う。
もちろん、それはエントリを分けてもいいけど、そういうのが触れられてるとよさそう。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここ、言ってることそもそも間違ってたので、消しておきます😇

Author から !important を用いて User の non-!important なスタイルを上書き

  • 別に Author で !important 使わなくても、User の non-!important は上書きできる。
  • User が !important な場合は、「守り」の設計により、Author はどう頑張っても上書きできない

@vercel vercel bot temporarily deployed to Preview – git-kusa July 12, 2025 12:13 Inactive
@sakupi01
Copy link
Owner Author

@Jxck
レビューありがとうございます!該当箇所直しました!
流れてるかもなんですが、Day4 も書いているので、お手隙で目を通してもらえるとめっちゃ助かります・・・

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants