💬
Basics

CSS Syntax & Comments

/* */, Rule Structure
💡 CSS comments (/* */) HTML comments jaisa hi concept hai — sticky notes jo browser ignore karta hai, sirf developers ke liye. CSS syntax ek recipe jaisa hai — selector (kis dish ke liye), curly braces mein ingredients (properties: quantities).

CSS comments /* comment text */ format mein hote hain (HTML ke <!-- --> se alag). Basic rule syntax: selector { property: value; property2: value2; } — har property-value pair semicolon se end hota hai.

Whitespace/formatting CSS mein (HTML jaisa hi) flexible hai — browser extra spaces/newlines ignore karta hai. Consistent indentation/formatting sirf readability ke liye hai.

/* Ye ek comment hai — browser ignore karega */
.card {
  padding: 20px;      /* padding around content */
  border-radius: 8px;   /* rounded corners */
  /* background-color: red;  — temporarily disabled */
  background-color: white;
}
💬
CSS comments (/* */) HTML comments jaisa hi concept hai — sticky notes jo browser ignore karta hai, sirf developers ke liye. CSS syntax ek recipe jaisa hai — selector (kis dish ke liye), curly braces mein ingredients (properties: quantities).
1 / 2
⚡ झट से Recap
  • /* comment */ = CSS comments syntax
  • selector { property: value; } = basic rule structure
  • Semicolons zaroori hain har property-value pair ke baad
इस page में (1 subtopics)

Common formatting styles: multi-line (har property apni line par, readable, most common) vs single-line (compact, minified production files mein). Team projects mein consistent formatting (Prettier jaisa auto-formatter) common hai.

/* Multi-line (readable, development): */
.card {
  padding: 20px;
  border-radius: 8px;
}

/* Single-line (compact): */
.card { padding: 20px; border-radius: 8px; }
💡Tip: Production deployment mein CSS usually "minified" hota hai (saare spaces/comments hataye jaate hain, file size chhota) — development mein readable format, build process automatically minify kar deta hai.