本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2830

embedded-or-inline-css

できること

このスキルは、HTMLに直接書かれたスタイルを確認します。コードをすっきりさせ、保守しやすくしたい開発者向けです。

使う場面

  • ✓ページのHTMLに style 属性が散らばっているとき。
  • ✓テンプレートに大きなスタイルブロックがあり、更新しにくいとき。
  • ✓ブラウザが複数のページでスタイルを再利用できるようにしたいとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/embedded-or-inline-css/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/embedded-or-inline-css/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“ページ内のインラインスタイルを、別のスタイルシートに移してもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、インラインとページ内に埋め込まれたスタイルを探し、外部ファイルへの移動を提案します。ファーストビューに必要な重要スタイルや、CSSカスタムプロパティなどの動的な値だけをインラインに残します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Avoid embedded and inline CSS

Inline CSS cannot be cached separately, increases HTML payload, breaks separation of concerns, and is harder to maintain in large codebases.

Quick Reference

  • Move inline styles to external CSS files or CSS-in-JS
  • Exception: critical CSS should be inlined for performance
  • Exception: dynamic values (CSS custom properties) can be inline
  • Inline CSS breaks caching and increases HTML size

Check

Verify that inline CSS and embedded styles are avoided except for valid use cases like critical CSS, dynamic styles, or performance optimization.

Fix

Move inline and embedded CSS to external stylesheets, keeping only critical above-the-fold CSS inline for performance optimization.

Explain

Explain why external CSS is preferred for maintainability, caching, and separation of concerns, with exceptions for critical CSS and dynamic styles.

Code Review

Review stylesheets, component styles, and responsive states related to Avoid embedded and inline CSS. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/embedded-or-inline-css

よくある質問

外部のスタイルシートのほうがよいのはなぜですか?

ブラウザがスタイルシートを別にキャッシュできるうえ、HTMLが小さくなり保守もしやすくなります。

インラインCSSはいつ許容されますか?

ファーストビューに必要な重要スタイルや、CSSカスタムプロパティのような動的な値は許容されます。

フレームワークにも対応していますか?

フレームワークのプロジェクトでは、CSS-in-JS を選択肢の一つとして挙げています。

詳細

作者による元の説明

Use when reviewing stylesheets, component styles, and responsive behavior related to Avoid embedded and inline CSS. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2830
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル