Formatera och indentera CSS

formaterar dina CSS-regler för att göra dem läsbara och lätta att underhålla

Pourquoi utiliser un outil de formatage CSS ?

Le formatage du code CSS est essentiel pour les développeurs afin de maintenir un code propre et lisible. Cet outil simplifie le processus en permettant de formater rapidement et précisément le code CSS, facilitant ainsi la maintenance et la collaboration sur les projets.

Caractéristiques de l'outil de formatage CSS

Cet outil de formatage CSS vous permet d'entrer du code CSS et de le formater pour une meilleure lisibilité. Il supprime les commentaires, les espaces et les tabulations inutiles, et ajoute une indentation appropriée pour les règles et les propriétés CSS.

Comment utiliser l'outil de formatage CSS

Pour utiliser l'outil de formatage CSS, suivez ces étapes simples :

  1. Entrez votre code CSS dans le champ prévu à cet effet.
  2. Cliquez sur le bouton "Formater". L'outil formatera le code CSS pour une meilleure lisibilité.
  3. Copiez le code CSS formaté pour l'utiliser dans vos projets.

Exemple d'utilisation de l'outil de formatage CSS

Voici un exemple de code CSS avant et après le formatage :


Avant le formatage :
body{font-family:Arial,sans-serif;background-color:#f0f0f0;margin:0;padding:0;}.container{width:80%;margin:0 auto;}.header{background-color:#333;color:#fff;padding:20px;text-align:center;}

Après le formatage :
body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
}

.container {
    width: 80%;
    margin: 0 auto;
}

.header {
    background-color: #333;
    color: #fff;
    padding: 20px;
    text-align: center;
}

Exempelförfrågan

curl -X POST https://cdrn.fr/api/v1/tools/css-formatter/execute \
  -H "Content-Type: application/json" \
  -d '{"input":"..."}'

Indatasschema

Fält Typ Obligatorisk Standard
input text

Slutpunkter

  • GET https://cdrn.fr/api/v1/tools - listar alla tillgängliga verktyg
  • GET https://cdrn.fr/api/v1/tools/css-formatter - hämtar schemat för detta verktyg
  • POST https://cdrn.fr/api/v1/tools/css-formatter/execute - kör detta verktyg med en JSON-payload