CSS Full Course Day 2 [Hindi] 💻 | Selectors & Properties 🚀 | Mohit Decodes

🎨 CSS Tutorial – Day 2: Selectors & Properties

Welcome to Day 2 of the CSS Full Course [Hindi] by Mohit Decodes! Today, we dive deeper into CSS by learning about selectors — how to target HTML elements — and properties that define the styles.

🔹 What are CSS Selectors?

Selectors specify which HTML elements to style. Some common selectors are:

  1. Element Selector: targets elements by tag name
css
CopyEdit
p { color: blue; }
  1. Class Selector: targets elements with a specific class
css
CopyEdit
.highlight { background-color: yellow; }
  1. ID Selector: targets a unique element by id
css
CopyEdit
#header { font-size: 24px; }
  1. Universal Selector: targets all elements
css
CopyEdit
* { margin: 0; padding: 0; }

🔹 CSS Properties

Properties define what aspect of the element to style. Examples include:

  1. color — text color
  2. background-color — background color
  3. font-size — text size
  4. margin — space outside element
  5. padding — space inside element
  6. border — border style and size

⚙️ Example:

css
CopyEdit
/* Make all paragraphs red with a light yellow background */
p {
color: red;
background-color: #ffffcc;
padding: 10px;
border: 1px solid #ccc;
}

💡 Tips:

  1. Combine selectors for precision (div.highlight)
  2. Use classes for reusable styles
  3. IDs should be unique per page