2. Selectors: element, class, id
Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.
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.
Ver ejemplo
.note {
background: #fef9c3;
}
#main {
max-width: 600px;
}
✍️ Ahora te toca
Give every element with class warning the colour red.