1

salut,

je ne trouve pas comment faire un selecteur "multiple"

j'ai ce code html par exemple :
<section class="auto"> <section class="auto"> <article> aa1 </article> <article> aa2<br>aa2 </article> </section> <article> a2<br>a2 </article> <article> a3 </article> <article> a4 </article> </section>

j'ai fait un bout de scss pour dimensionner "automatiquement" mes colonnes
@for $i from 2 through 12 { > *:first-child:nth-last-child(#{$i}), > *:first-child:nth-last-child(#{$i}) ~ * { width: (100% / $i) - 1; } }

mais je suis obligé de cibler avec *, moi je ne veut filtrer que les articles et sections

j'ai testé ca : > article:first-child:nth-last-child(#{$i}), > article:first-child:nth-last-child(#{$i}) ~ article, > article:first-child:nth-last-child(#{$i}) ~ section, > section:first-child:nth-last-child(#{$i}), > section:first-child:nth-last-child(#{$i}) ~ section, > section:first-child:nth-last-child(#{$i}) ~ article

mais visiblement le nth-last-child cible uniquement le même élément qu'en début de ligne, il n'est pas global à tous les enfants

il n'existe pas une syntaxe magique pour sélectionner simplement les deux ? un genre de :not inverse ?

genre dans cet esprit ? > (article,section):first-child:nth-last-child(#{$i}), > (article,section):first-child:nth-last-child(#{$i}) ~ (article,section)
et la le mec il le pécho par le bras et il lui dit '

2

bon en fait * c'est pas plus mal comme ca je peu aussi gérer les p et img dans les articles

mais si qq à la réponse ca m’intéresse tout de même :- )

'tin je découvre les préprocesseur css et les media query, ca me donne pleins d'idées :- )))
@include onMobile { .auto.breakm { // pair 4+ colons double size $c:4; @while $c <= $maxByLine { $cc: $c / 2; > *:first-child:nth-last-child(#{$c}), > *:first-child:nth-last-child(#{$c}) ~ * { width: (100% / $cc) - 1; } // middle break > *:first-child:nth-last-child(#{$c}) ~ *:nth-child(#{$cc + 1}) { clear:left; } $c: $c + 2; } // impair 3+ colons "double" size $c:3; @while $c <= $maxByLine { $cc: ($c - 1) / 2; // first $first:$cc + 1; > *:first-child:nth-last-child(#{$c}), > *:first-child:nth-last-child(#{$c}) ~ *:nth-child(-n+#{$first}) { width: (100% / $first) - 1; } // middle break > *:first-child:nth-last-child(#{$c}) ~ *:nth-child(#{$first + 1}) { clear:left; } // last > *:first-child:nth-last-child(#{$c}) ~ *:nth-last-child(-n+#{$cc}) { width: (100% / $cc) - 1; } $c: $c + 2; } } }
et la le mec il le pécho par le bras et il lui dit '