Search

Nalezeno "css-tricks": 2942

Native CSS Masonry Layout In CSS Grid


Rachel Andrew introducing the fact that masonry layout is going to be a thing in native CSS via CSS grid layout. The thing with masonry is that we can already do it for the most part, but there is just one thing that makes it hard: doing the vertical-staggering and having a left-to-right source...

Super Tiny Icons


A bunch of SVG icons (of popular things) all under 1KB. SVG is awesome for golfing. I was going to add a CodePen logo but there is already one in there at 375 Bytes. I’ve got one at 208 Bytes, based on a logo update David DeSandro did for us a couple years back. Direct Link to Article...

Lots of Ways to Use Math.random() in JavaScript


Math.random() is an API in JavaScript. It is a function that gives you a random number. The number returned will be between 0 (inclusive, as in, it’s possible for an actual 0 to be returned) and 1 (exclusive, as in, it’s not possible for an actual 1 to be returned). Math.random(); // returns...

A Complete State Machine Made With HTML Checkboxes and CSS


State machines are typically expressed on the web in JavaScript and often through the popular XState library. But the concept of a state machine is adaptable to just about any language, including, amazingly, HTML and CSS. In this article, we’re going to do exactly that. I recently built a website...

Exploring What the Details and Summary Elements Can Do


We’ve mentioned before just how great the <details> and <summary> elements are. They’re great for quickly making accordions that are accessible to touch, mouse, and keyboard input: CodePen Embed Fallback <details> and <summary> can even be used to play/pause gifs!...

Three Things You Didn’t Know About AVIF


AVIF, the file format based on the AV1 video codec, is the latest addition to the next-gen image formats. Early reports and comparisons show good results compared to JPEG and WebP. However, even if browser support is good, AVIF is still on the bleeding edge in regards to encoding and decoding....

Tailwind versus BEM


Some really refreshing technological comparison writing from Eric Bailey. Like, ya know, everything in life, we don’t have to hate or love everything. Baby bear thinking, I like to say. There are benefits and drawbacks. Every single bullet point here is well-considered and valid. I really...

Considerations for Making a CSS Framework


Around eight months ago, I started building a framework which would eventually go on to become Halfmoon. I made a post on this very website announcing the launch of the very first version. Halfmoon has been billed as a Bootstrap alternative with a built-in dark mode feature, that is especially good...

Rendering Spectrum


Here are the big categories of rendering websites: Client: ship a <div id="root"></div> and let a JavaScript template render all of it. Static: pre-render all the HTML. Server: let a live server process requests and generate the HTML response. They are not mutually exclusive....

How to Load Fonts in a Way That Fights FOUT and Makes Lighthouse Happy


A web font workflow is simple, right? Choose a few nice-looking web-ready fonts, get the HTML or CSS code snippet, plop it in the project, and check if they display properly. People do this with Google Fonts a zillion times a day, dropping its <link> tag into the <head>. Let’s...

The Core Web Vitals hype train


Some baby bear thinking from Katie Sylor-Miller: my excitement for Core Web Vitals is tempered with a healthy skepticism. I’m not yet convinced that Largest Contentful Paint (LCP), First Input Delay (FID), and Cumulative Layout Shift (CLS) are the right metrics that all sites should...

Creating UI Components in SVG


I’m thoroughly convinced that SVG unlocks a whole entire world of building interfaces on the web. It might seem daunting to learn SVG at first, but you have a spec that was designed to create shapes and yet, still has elements, like text, links, and aria labels available to you. You can accomplish...

How to Create a Timeline Task List Component Using SVG


I’m thoroughly convinced that SVG unlocks a whole entire world of building interfaces on the web. It might seem daunting to learn SVG at first, but you have a spec that was designed to create shapes and yet, still has elements, like text, links, and aria labels available to you. You can accomplish...

Graphery SVG


I’ve compared SVG and Canvas before. If you’re trying to decide between them, read that. I’d say the #1 difference between them is vector (SVG) versus raster (Canvas). But the #2 difference is how you work with them. SVG is declarative, as in, literal elements that express what they are through...

DRY-ing up styled-components


I like working with styled-components. They allow you write CSS in your JavaScript, keeping your CSS in very close proximity to your JavaScript for a single component. As a front-end developer who loves to dissect a web page and break it down into reusable components, the idea of styled-components...

What’s Missing from CSS?


The survey results from the State of CSS aren’t out yet, but they made this landing page that randomly shows you what one person wrote to answer that question. Just clicking the reload button a bunch, I get the sense that the top answers are: Container Queries Parent...

How You Might Build a Modern Day Webring


I’m sure different people picture different things when they think about webrings, so let me clarify what I picture. I see an element on a website that: Signifies this site is part of a webring Allows you to move to the next or previous site of the webring Maybe has other functionality like...

A Dynamically-Sized Sticky Sidebar with HTML and CSS


Creating page content that sticks to the viewport as you scroll, something like a jump-to-anchor menu or section headings, has never been easier. Throw a position: sticky into your CSS ruleset, set the directional offset (e.g. top: 0) and you’re ready to impress your teammates with minimal effort....

console.log({ myVariable });


I think this might be my most popular tweet of all time, but I’m not sure how to verify that these days. I’ll restate this neat little trick here because blogging is cool and fun. I used to do this a lot while debugging JavaScript: console.log("myVariable: ", myVariable); But now I...

mediastack


Have you ever had the idea for a website or new app that involved showing news content? You don’t have to create content yourself to have the right to build an innovative news reading experience. I remember when Flipboard came out. They didn’t (and still don’t) actually produce...

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