PROJET AUTOBLOG


Warrior du Dimanche

Site original : Warrior du Dimanche

⇐ retour index

CSS - 5t3ph@front-end.social - I'm not sure enough folks realize that :is()/:where(), and :not() can check _ancestor_ and _previous sibling_ conditions.p:is(h2 + *) = paragraphs that are directly after an h2p:not(blockquote *) = paragraphs that are not within blockquotesI've used these techniques to simplify what would otherwise be rather unmaintainable selectors or may have previously required additional conditional classes.https://codepen.io/5t3ph/pen/KKEmMXR

mardi 30 janvier 2024 à 13:36

Pas mal cette astuce ! On peut avoir des conditions qui prennent en compte un élément parent ou un élément frère pour cibler un élément...

Ça peut carrément simplifier certains cas !

<link rel="stylesheet" href="http://www.warriordudimanche.net/./plugins/Galart/style.css"/> <link rel="stylesheet" href="http://www.warriordudimanche.net/./plugins/Galart/assets/lightbox.css"/> <script src="http://www.warriordudimanche.net/./plugins/Galart/assets/lightbox.js"> <script>[].forEach.call(document.querySelectorAll("[lightbox]"), function(el) { el.lightbox = new Lightbox(el);});

► Commentaires