#css

206 bookmarks tagged with #css · RSS Feed · ← All Tags

argyleink/prop-for-that: what JS knows, now CSS knows

https://github.com/argyleink/prop-for-that
Sliders, pointer position, element visibility, viewport size, battery, network, sensors — JavaScript can read all of it; CSS can't. prop-for-that writes that runtime state into --live-* and --const-* custom properties — batched and diffed down to one setProperty per frame — so your CSS can compose and react to it with plain calc() and var().

Introduction - Neobrutalism components

https://www.neobrutalism.dev/docs
Neobrutalism is a mix of regular brutalism in web design and more modern typography, illustration, and animation standards. Neobrutalism refuses the usual components of UX-UI design and embraces uncomfortable design elements, and it is more fearless to use distinctive color palettes.

How to Make a Damn Website

https://lmnt.me/blog/how-to-make-a-damn-website.html
A lot of people want to make a website but don’t know where to start or they get stuck. That’s in part because our perception of what websites should be has changed so dramatically over the last 20 years.

Using CSS nesting - CSS | MDN

https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Nesting/Using
The CSS nesting module allows you to write your stylesheets so that they are easier to read, more modular, and more maintainable. As you are not constantly repeating selectors, the file size can also be reduced. CSS nesting is different from CSS preprocessors such as Sass in that it is parsed by the browser rather than being pre-compiled by a CSS preprocessor. Also, in CSS nesting, the specificity of the & nesting selector is similar to the :is() function; it is calculated using the highest specificity in the associated selector list.

Shuffling a CSS grid using custom properties | Christian Heilmann

https://christianheilmann.com/2025/11/24/shuffling-a-css-grid-using-custom-properties/
The grid above shuffles around on every reload or when you active `shuffle` button. There are many ways to achieve this effect, but this example uses only CSS properties to set the order of the grid items. The HTML is not altered and there is no DOM manipulation other than accessing the CSS properties of the parent element. This should make this highly performant. The JavaScript code rotates the order of the items in the grid by changing the CSS variables that define their order.

The Pixel Canvas Shimmer Effect

https://ryanmulligan.dev/blog/pixel-canvas/
I recently stumbled on a super cool, well-executed hover effect from the clerk.com website where a bloom of tiny pixels light up, their glow staggering from the center to the edges of its container. With some available free time over this Thanksgiving break, I hacked together my own version of a pixel canvas background shimmer. It quickly evolved into a pixel-canvas Web Component that can be enjoyed in the demo below. The component script and demo code have also been pushed up to a GitHub repo.

How to fix Storybook screenshot testing | Tiger Oakes

https://tigeroakes.com/posts/storybook-test-runner-screenshots/
As an alternative to Chromatic, I’ve been using Storybook’s Test Runner to power screenshot tests for Microsoft Loop. We configure the test runner to run in CI and take a screenshot of every story. However, the initial implementation based on the official Storybook docs was very flaky due to inconsistent screenshots of the same story. Here are some tips to reduce flakiness in your Storybook screenshot tests.

:has() - CSS: Cascading Style Sheets | MDN

https://developer.mozilla.org/en-US/docs/Web/CSS/:has
The functional :has() CSS pseudo-class represents an element if any of the relative selectors that are passed as an argument match at least one element when anchored against this element. This pseudo-class presents a way of selecting a parent element or a previous sibling element with respect to a reference element by taking a relative selector list as an argument.

CSS container queries - CSS: Cascading Style Sheets | MDN

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_containment/Container_queries
Container queries enable you to apply styles to an element based on the size of the element's container. If, for example, a container has less space available in the surrounding context, you can hide certain elements or use smaller fonts.

Example of Tabs with Automatic Activation | APG | WAI | W3C

https://www.w3.org/WAI/ARIA/apg/patterns/tabs/examples/tabs-automatic/
This example section demonstrates a tabs widget that implements the Tabs Pattern. In this example, a tab is automatically activated and its associated panel is displayed when the tab receives focus. It is recommended that authors consider implementing automatic activation of tabs only in circumstances where panels can be displayed instantly, i.e., all panel content is present in the DOM.

Tree views in CSS

https://iamkate.com/code/tree-views
A tree view (collapsible list) can be created using only HTML and CSS, without the need for JavaScript. Accessibility software will see the tree view as lists nested inside disclosure widgets, and the standard keyboard interaction is supported automatically.

DRY Switching with CSS Variables: The Difference of One Declaration | CSS-Tricks

https://css-tricks.com/dry-switching-with-css-variables-the-difference-of-one-declaration/?unapproved=1674473&moderation-hash=4e9cb4ef4344732a9e5a5ca87b6d0849#comment-1674473
This is the first post of a two-part series that looks into the way CSS variables can be used to make the code for complex layouts and interactions less difficult to write and a lot easier to maintain. This first installment walks through various use cases where this technique applies.

DRY Switching with CSS Variables: The Difference of One Declaration | CSS-Tricks

https://css-tricks.com/dry-switching-with-css-variables-the-difference-of-one-declaration?moderation-hash=4e9cb4ef4344732a9e5a5ca87b6d0849&unapproved=1674473#comment-1674473
This is the first post of a two-part series that looks into the way CSS variables can be used to make the code for complex layouts and interactions less difficult to write and a lot easier to maintain. This first installment walks through various use cases where this technique applies.

Case Study: Auto-Resizing HTML5 Games - HTML5 Rocks

http://www.html5rocks.com/en/tutorials/casestudies/gopherwoord-studios-resizing-html5-games/
In the summer of 2010, we created Sand Trap, a game that we entered in a competition on HTML5 games for mobile phones. But most mobile phones either displayed only part of the game or made the game too small—making it completely unplayable. So we took it upon ourselves to make the game fluidly adjust to match any resolution. After a bit of re-programming and using ideas outlined in this article, we had a game that scaled across any modern browser, whether it ran in a desktop or a mobile device.

Case Study: Auto-Resizing HTML5 Games - HTML5 Rocks

http://www.html5rocks.com/en/tutorials/casestudies/gopherwoord-studios-resizing-html5-games
In the summer of 2010, we created Sand Trap, a game that we entered in a competition on HTML5 games for mobile phones. But most mobile phones either displayed only part of the game or made the game too small—making it completely unplayable. So we took it upon ourselves to make the game fluidly adjust to match any resolution. After a bit of re-programming and using ideas outlined in this article, we had a game that scaled across any modern browser, whether it ran in a desktop or a mobile device.

Ladda

http://lab.hakim.se/ladda/
A UI concept which merges loading indicators into the action that invoked them. Primarily intended for use with forms where it gives users immediate feedback upon submit rather than leaving them wondering while the browser does its thing. For a real-world example, check out any of the forms on slid.es.

Ladda

http://lab.hakim.se/ladda
A UI concept which merges loading indicators into the action that invoked them. Primarily intended for use with forms where it gives users immediate feedback upon submit rather than leaving them wondering while the browser does its thing. For a real-world example, check out any of the forms on slid.es.

Demoing and displaying JavaScript at the same time using CSS | Christian Heilmann

http://christianheilmann.com/2012/05/08/demoing-and-displaying-javascript-at-the-same-time-using-css/
If you do a view-source you find no other script in use, yet it displays in the page. What is this sourcery*? Simple, and it was Mathias Bynens who got me onto it: just display script elements as block and add some generated content to show the “Source” text:

Demoing and displaying JavaScript at the same time using CSS | Christian Heilmann

http://christianheilmann.com/2012/05/08/demoing-and-displaying-javascript-at-the-same-time-using-css
If you do a view-source you find no other script in use, yet it displays in the page. What is this sourcery*? Simple, and it was Mathias Bynens who got me onto it: just display script elements as block and add some generated content to show the “Source” text:

Arctext.js - Curving Text with CSS3 and jQuery | Codrops

http://tympanus.net/codrops/2012/01/24/arctext-js-curving-text-with-css3-and-jquery
While CSS3 allows us to rotate letters, it is quite complicated to arrange each letter along a curved path. Arctext.js is a jQuery plugin that let's you do exactly that. Based on Lettering.js, it calculates the right rotation of each letter and distributes the letters equally across the imaginary arc of the given radius.

CSS Media Queries

http://cssmediaqueries.com
HTML4 and CSS2 currently support media-dependent style sheets tailored for different media types. A media query consists of a media type and zero or more expressions that check for the conditions of particular media features. Seems like a nifty site to vet media queries on all my devices

Detecting Support for data: URIs | Weston Ruter

http://weston.ruter.net/2009/05/07/detecting-support-for-data-uris
The data: URI scheme is now supported by the most current version of every major browser, including Internet Explorer. Because of this I wanted to use CSS background images encoded with data: URIs in a current project at Shepherd Interactive. Why? The first rule of High Performance Websites is to Minimize HTTP Requests. By storing background images directly in the stylesheet only one HTTP request is then necessary to fetch the stylesheet and the images all at once. Furthermore, by giving that stylesheet a far-future cache expiration date the browser will never need to request it again.

jQuery Masonry · David DeSandro

http://desandro.com/resources/jquery-masonry
"Masonry is a layout plugin for jQuery. Think of it as the flip side of CSS floats. Whereas floating arranges elements horizontally then vertically, Masonry arranges elements vertically then horizontally according to a grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall."

The New Lens Flare · David DeSandro

http://desandro.com/articles/the-new-lens-flare
"By abusing the text-shadow property, you can turn any ho-hum bit of text into a magnificent, radiant beacon of allure and awe. But getting your bling-bling on has never been for the cheapskates. Expect to pay a boatload in refresh rates, as your browser buckles under the weight of rendering that glorious halo."

Jon Rohan · Creating Triangles in CSS

http://www.dinnermint.org/css/creating-triangles-in-css
"I’ve come across a few techniques and tips in my career, while working at my last gig a co-worker pointed me to this technique. I believe this was originally discovered by the legendary Eric Meyer, but I couldn’t find much documentation about it on the web so I thought I would describe it here."

The Demise of Plain CSS: Why Sass And Languages Like It Will Triumph

http://wiseheartdesign.com/articles/2010/01/18/the-demise-of-css-why-sass-and-languages-like-it-will-triumph
"Just like higher-level programming languages compile to assembler, so Sass compiles to CSS. And just as higher-level programming languages eventually replaced the regular usage of assembler, so Sass (or a language like it) will eventually replace CSS. Now, don’t get me wrong. I am sure CSS has many more years ahead of it, but Sass and languages like it are the future. Yes, you can complain about the syntax. You can complain about the generated code. But ultimately, the productivity and simplicity that languages like Sass offer will win over the masses. Of that you can be sure."

Some Notes On iTunes LP · Jay Robinson

http://jayrobinson.org/2009/09/11/some-notes-on-itunes-lp
"The iTunes LP experience is accomplished with HTML 4.01, CSS and JS. The interface feels very Flash-like, but there is no trace of it. The CSS animations are elaborate and smooth. ... As a music fan, and as a web developer, I couldn’t be more pleased with the new iTunes LP offering. If your audience is significantly Apple-oriented (e.g. a site about Mac rumors or a popular iPhone app) this proves that you can provide an incredible experience using only JavaScript and some proposed CSS3 properties."

Weekend coding: Add a character counter as the background of a textarea with JavaScript | CodeUtopia

http://codeutopia.net/blog/2009/08/01/weekend-coding-add-a-character-counter-as-the-background-of-a-textarea-with-javascript
"Have you ever filled a textarea on a page, which had a limit to how many characters you could type into it? ... How to effectively communicate how many characters you can type into a box, and have it look good. ... Add the number counter as the background of the textarea!"

To Sprite Or Not To Sprite at Vladimir Vukićević

http://blog.vlad1.com/2009/06/22/to-sprite-or-not-to-sprite
"The biggest problem with CSS sprites is memory usage. Unless the sprite image is carefully constructed, you end up with incredible amounts of wasted space. My favourite example is from WHIT TV's web site, where this image is used as a sprite. Note that this is a 1299x15,000 PNG. It compresses quite well — the actual download size is around 26K — but browsers don't render compressed image data. When this image is downloaded and decompressed, it will use almost 75MB in memory (1299 * 15000 * 4)."

how to make ie6 behave - work blog - onderhond.com

http://www.onderhond.com/blog/work/ie6-core-bug-fixing
"No doubt there is more. I'm not an expert on ie6 debugging, but for the greater part these are issues that pop up with every project, and getting these fixes in as quickly as possible makes for much easier ie6 debugging afterwards. Whether you create your ie6 css alongside your main css or run through your main css to construct a ie6 css when everything is finished is entirely up to you. But when you make sure all the above is taken care of, ie6 will look like a much nicer browser. "

10 Useful Techniques To Improve Your User Interface Designs | How-To | Smashing Magazine

http://www.smashingmagazine.com/2008/12/15/10-useful-techniques-to-improve-your-user-interface-designs
"1. Padded block links 2. Typesetting buttons 3. Using contrast to manage focus 4. Using color to manage attention 5. White space indicates relationships 6. Letter spacing 7. Auto-focus on input 8. Custom input focus 9. Hover controls 10. Verbs in labels"

james.padolsey/style.css

http://james.padolsey.com/wp-content/themes/james.padolsey/style.css
Huh, I didn't know you could customize the text selection highlight color in CSS. "::selection { background: #CF0000; color: white; /* Safari */ } ::-moz-selection { background: #CF0000; color: white; /* Firefox */ } "

Nihilogic: Sandbag text wrapping with Canvas

http://blog.nihilogic.dk/2008/09/sandbag-text-wrapping-with-canvas.html
"With CSS you can make text wrap around an image using the float property and for most purposes this is quite adequate. However, it doesn't take into account the actual image and treats it as one big block, even if you'd prefer the text to wrap around the actual content in the picture, magazine style.Since we now have pixel access (in cool browsers, anyway) via the Canvas element, this technique can now be implemented dynamically with a bit of JavaScript."

Text + Image + CSS3 = Crazy Delicious

http://metaatem.net/highlite?colors=128&image=http://images.slashdot.org/topics/topiced.gif&text=start+coming+up+with+overregularizations+like+%22goed%22+instead+of+%22went%22+or+%22playses%22+in+place+of+%22plays,%22+that+kind+of+attempt+at+applying+regular+morphological+rules+to+irregular+items,+is+when+you+might+say+they+are+acquiring+language+via+data+mining.+I.e.,+they+hear+a+form+used+often+enough+that+it+becomes+part+of+their+knowledge+about+words,+to+the+extent+that+that+form+is+unconsciously+applied+even+to+make+words+they+have+certainly+never+heard+in+adult+speech+before.+&width=120
"Hide an image in html"

Link Specificity

http://meyerweb.com/eric/css/link-specificity.html
"I tried to apply CSS to my hyperlinks and the hovering didn't work. How come? Is this another case of browsers being stupid?"

Default style sheet for HTML 4.0

http://www.w3.org/TR/CSS21/sample.html
"This style sheet describes the typical formatting of all HTML 4.0 ([HTML40]) elements based on extensive research into current UA practice. Developers are encouraged to use it as a default style sheet in their implementations."

Tabtastic

http://phrogz.net/JS/Tabtastic/index.html
"This library is a simple way to implement tabs on your page using CSS, a little JS, and semantic markup which degrades gracefully on browsers with CSS unavailable or disabled."

CSS Pencils v3.1

http://www.designdetector.com/tips/csspencils.php
"THERE ARE NO IMAGES ON THIS PAGE!" This page features a small image entirely composed of colored div pixels. MY HEAD A SPLODE.

Let Them Eat Cake

http://www.alistapart.com/articles/eatcake
"There has been a growing debate lately that pits accessibility against usability, but there’s no reason we can’t have both."

Exploring Footers: A List Apart

http://www.alistapart.com/articles/footers
"If you want to center content vertically or stick a footer to the bottom of the browser window...[use a table]... With web standards, you can’t do this anymore."

Accessible contents menu?

http://www.clagnut.com/blog/277
"Clagnut’s global navigation is a JavaScript-driven drop down (the Site contents button graphical browsers will see top-right). An accessibility no-no, you might think, but I reckon otherwise."