Search

Nalezeno "QR code": 1615

Import Non-ESM libraries in ES Modules, with Client-Side Vanilla JS


We’re living through a weird era where there are tons of JavaScript libraries that were meant to be used as <script> tags that expose available globals. AND there are tons of JavaScript libraries that are meant to be used through module loaders. AND there are tons of JavaScript...

Working with JavaScript Media Queries


What’s the first thing that comes to mind when you think of media queries? Maybe something in a CSS file that looks like this: body {   background-color: plum; } 
 @media (min-width: 768px) {   body {     background-color: tomato;   } } CSS media queries are a core ingredient in any responsive...

Using max() for an inner-element max-width


I go into all this in The “Inside” Problem. The gist: you want an edge-to-edge container, but the content inside to have a limited width. I think there is absolutely no problem using a nested element inside, but it’s also fun to look at the possibilities of making that work on...

Stroke Text CSS: The Definitive Guide


Whenever I think of stroked text on the web I think: nope. There is -webkit-text-stroke in CSS for it, but it places that stroke in the middle of the vector outline of the characters, absolutely ensuring that the character doesn’t look right. Just look at this in Chrome or Safari. Gross....

How to Simplify SVG Code Using Basic Shapes


There are different ways to work with icons, but the best solution always includes SVG, whether it’s implemented inline or linked up as an image file. That’s because they’re “drawn” in code, making them flexible, adaptable, and scalable in any context. But when working with SVG, there’s always...

Using @property for CSS Custom Properties


Una Kravetz digs into how Chrome now allows you to declare CSS custom properties directly from CSS with more information than just a string. So rather than something like this: html { --stop: 50%; } …can be declared with more details like this: @property --stop { syntax:...

Excluding Emojis From Transparent Text Clipping


CSS-Tricks has this pretty cool way of styling hovered links. By default, the text is a fairly common blue. But hover of the links, and they’re filled with a linear gradient. 😍 Pretty neat, right? And the trick isn’t all that complicated. On hover… give the link a linear...

How to Use CSS Grid for Sticky Headers and Footers


CSS Grid is a collection of properties designed to make layout easier than it’s ever been. Like anything, there’s a bit of a learning curve, but Grid is honestly fun to work with once you get the hang of it. One area where it shines is dealing with headers and footers. With a little...

How to Make a Media Query-less Card Component


Fun fact: it’s possible to create responsive components without any media queries at all. Certainly, if we had container queries, those would be very useful for responsive design at the component level. But we don’t. Still, with or without container queries, we can do things to make our components...

Number Scrubbing


If you use <input type="number">, some browsers give you an input that has UI for incrementing the number, like up/down arrows (often called “spinners”). That’s a bit helpful sometimes. But people have certainly explored fancier ways of updating that number....

Copy the Browser’s Native Focus Styles


Remy documented this the other day. Firefox supports a Highlight keyword and both Chrome and Safari support a -webkit-focus-ring-color keyword. So if you, for example, have removed focus from something and want to put it back in the same style as the browser default, or want to apply a focus style...

This vs. That


Here’s a nice site from Phuoc Nguyen, who I’ve noted before has quite a knack for clever sites. This vs. That pits different related concepts against each other as a theme for an article. For example, CSS has display: none;, opacity: 0;, and visibility: hidden; and they all, on...

Offering Options for mailto: and tel: Links


I generally like mailto: links. But I feel like I can smell a mailto: link without even inspecting or clicking it, like some kind of incredibly useless superpower. I know that if I’ve got my default mail client set, clicking that link will do what I want it to do, and if I want, I...

A CSS-only, animated, wrapping underline


Nicky Meuleman, inspired by Cassie Evans, details how they built the anchor link hover on their sites. When a link is hovered, another color underline kinda slides in with a gap between the two. Typical text-decoration doesn’t help here, so multiple backgrounds are used instead,...

Leading-Trim: The Future of Digital Typesetting


leading-trim is a suggested new CSS property that lets us remove the extra spacing in every font so that we can more predictably style text. Ethan Wang has written about it — including how Microsoft has advocated for it — and that it’s now part of the Inline Layout Module Level 3 spec. You’d use...

Optimize Images with a GitHub Action


I was playing with GitHub Actions the other day. Such a nice tool! Short story: you can have it run code for you, like run your build processes, tests, and deployments. But it’s just configuration files that can run whatever you need. There is a whole marketplace of Actions wanting to do work...

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