Consigli su come chiamare i nostri selettori css

Alen Grakalic ci da dei consigli molto semplici e pratici su come chiamare i nostri selettori, districandosi fra classi, id, gerarchie e parentele (sto sempre parlando di css si intende ahah).
Secondo me è molto chiaro e semplice.
Ecco uno stralcio dell’articolo:

Combinations

#main h2.title span

This type of selector allows you to be very precise in targeting an element.
The principle I use is: I try to determine the lowest container in hierarchy that has non-repeating elements. I add class name to the container and target the elements inside with type selectors similar to example above. If you have a H2 tag that you use for titles, and you have only one span inside it, there’s really no need of adding a class name to that span. You can easily target it with combined selector shown above.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Iscriviti alla newsletter

…se vuoi ricevere qualche consiglio su come spingere la tua attività sul web

Lauryn è un progetto che esiste dal 2001 ed è ideato da Laura Gargiulo, web designer ed esperta di web marketing.

Chi sono

About Us

Contact Us

Products

Services

Blog

Features

Analytics

Engagement

Builder

Publisher

Help

Privacy Policy

Terms

Conditions

Product

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
You have been successfully Subscribed! Ops! Something went wrong, please try again.

Laura Gargiulo | professionista ai sensi della Legge 4/2013 | Via Arrigo Minerbi 3, 20142 Milano – PI IT10339790965‬ |
Tutti i diritti riservati© 2025 Created with Royal Elementor Addons

Torna in alto