Starlit Daily

📚 › CSS: style and layout

2. Selectors: element, class, id

इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।

An element selector (p) styles all paragraphs. A class selector starts with a dot (.note) and styles every element with that class. An id selector starts with # (#main) and matches one element on the page.

Use classes for styles you reuse. Use ids sparingly.

उदाहरण देखें

.note {
  background: #fef9c3;
}
#main {
  max-width: 600px;
}

✍️ अब आपकी बारी

Give every element with class warning the colour red.

← कोर्स पर वापस