Beautifier CSS

Réindente le code pour le lire ; ne remplace pas les tests d’exécution.

Entrée: TexteRésultat: Texte

Saisie de texte

Options

Exemples

Read a responsive two-column card layout

Entrée

.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
  }
}
Indenter la chaîne
Inspect focus styles without losing the attribute selector

Entrée

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
}
Indenter la chaîne
Trace a custom property through a dark-mode override

Entrée

: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)
}
Indenter la chaîne
Separate the steps of an opacity animation

Entrée

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

Expected answer

@keyframes fade{
  0%{
    opacity:0
  }
  50%{
    opacity:.5
  }
  100%{
    opacity:1
  }
}
Indenter la chaîne
Read a print rule that hides navigation

Entrée

/* 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
    }
}
Indenter la chaîne

Paramètres

ParamètreValeur par défautEntrée et choix
Indenter la chaîne"\\t"Les séquences d’échappement comme \n, \r et \t sont acceptées

Outils associés

Nettoyage du code

Référence de l’opération

Voir la documentation technique originale (English)