CSSを整形

コードを字下げ・整形して読みやすくします。 動作検証は別途必要です。

入力: テキスト結果: テキスト

テキスト入力

ツールの設定

使用例

Read a responsive two-column card layout

入力

.cards{display:grid;grid-template-columns:repeat(2,1fr);gap:1rem}@media(max-width:40rem){.cards{grid-template-columns:1fr}}

Expected answer

.cards{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1rem
}
@media(max-width:40rem){
  .cards{
    grid-template-columns:1fr
  }
}
インデント文字列
Inspect focus styles without losing the attribute selector

入力

button[data-state="open"]:focus-visible{outline:2px solid #005fcc;outline-offset:3px}

Expected answer

button[data-state="open"]:focus-visible{
    outline:2px solid #005fcc;
    outline-offset:3px
}
インデント文字列
Trace a custom property through a dark-mode override

入力

:root{--surface:#fff;--ink:#111}.dark{--surface:#111;--ink:#fff}.panel{background:var(--surface);color:var(--ink)}

Expected answer

:root{
	--surface:#fff;
	--ink:#111
}
.dark{
	--surface:#111;
	--ink:#fff
}
.panel{
	background:var(--surface);
	color:var(--ink)
}
インデント文字列
Separate the steps of an opacity animation

入力

@keyframes fade{0%{opacity:0}50%{opacity:.5}100%{opacity:1}}

Expected answer

@keyframes fade{
  0%{
    opacity:0
  }
  50%{
    opacity:.5
  }
  100%{
    opacity:1
  }
}
インデント文字列
Read a print rule that hides navigation

入力

/* Paper copy */@media print{nav,.toolbar{display:none}a{color:#000;text-decoration:underline}}

Expected answer

/* Paper copy */
@media print{
    nav,.toolbar{
        display:none
    }
    a{
        color:#000;
        text-decoration:underline
    }
}
インデント文字列

パラメーター

パラメーター既定値入力と選択肢
インデント文字列"\\t"\n、\r、\t などのエスケープシーケンスに対応

関連ツール

コード整形

操作の参考資料

元の技術文書を見る (English)