Search

Nalezeno "selectors": 12

@supports selector()


I didn’t realize the support for @supports determining selector support was so good! I usually think of @supports as a way to test for property: value pair support. But with the selector() function, we can test for selector support … The post @supports selector() appeared first...

You want enabling CSS selectors, not disabling ones


I think this is good advice from Silvestar Bistrović: An enabling selector is what I call a selector that does a job without disabling the particular rule. The classic example is applying margin to everything, only to have to remove … The post You want enabling CSS selectors, not disabling...

Meet `:has`, A Native CSS Parent Selector


The reasons that are often cited that make container queries difficult or impossible is things like infinite loops—e.g. changing the width of an element, invalidating a container query, which changes the width again, which makes the container query take effect, … The post Meet `:has`,...

Can I :has()


I just joked that we’re basically getting everything we want in CSS super fast (mostly referring to container queries, my gosh, can you imagine they are actually coming?). Now we might actually get parent selectors?! As in .parent:has(.child) { … The post Can I :has() appeared first...

CSS Vocabulary


This is a neat interactive page by Ville V. Vanninen to reference the names of things in the CSS syntax. I feel like the easy ones to remember are “selector,” “property,” and “value,” but even as a person who writes about CSS a lot, I forget some of the others....

Responsive Styling Using Attribute Selectors


One of the challenges we face when implementing class-based atomic styling is that it often depends on a specific breakpoint for context. <div class="span-12"</div<!-- we want this for small screens  --<div class="span-6"</div<!-- we want this for medium screens --<div...

A Complete Guide to Data Attributes


Everything you ever wanted to know about data attributes in HTML, CSS, and JavaScript. The post A Complete Guide to Data Attributes appeared first on CSS-Tricks

A Use Case for a Parent Selector


Having a "parent selector" in CSS is mentioned regularly as something CSS could really use. I feel like I've had that thought plenty of times myself, but then when I ask my brain for a use case, I find it hard to think of one. Well, I just had one so I thought I'd document it here. A classic...

Could Grouping HTML Classes Make Them More Readable?


You can have multiple classes on an HTML element: <div class="module p-2"></div> Nothing incorrect or invalid there at all. It has two classes. In CSS, both of these will apply: .module { } .p-2 { } const div...

Styling Based on Scroll Position


Rik Schennink documents a system for being able to write CSS selectors that style a page when it has scrolled to a certain point. If you're like me, you're already on the lookout for document.addEventListener('scroll' ... and being terrified about performance. Rik gets to that right away by both...

Text Wrapping & Inline Pseudo Elements


I love posts like this. It's just about adding a little icon to the end of certain links, but it ends up touching on a million things along the way. I think this is an example of why some people find front-end fun and some people rather dislike it. Things involved: Cool [attribute] selectors that...

CSS Selectors are Conditional Statements


foo { } Programmatically, is: if (element has a class name of "foo") { } Descendent selectors are && logic and commas are ||. It just gets more complicated from there, with things like combinators and pseudo selectors. Just look at all the ways styles can cascade. Jeremy Keith: If...

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace