Search
The Different (and Modern) Ways to Toggle Content
8.11.2024
Let’s spend some time looking at disclosures, the Dialog API, the Popover API, and more. We’ll look at the right time to use each one depending on your needs. Modal or non-modal? JavaScript or pure HTML/CSS? Not sure? Don’t worry, we’ll go into all that.
The Different (and Modern) Ways...
World Of Warcraft Is Adding An Arachnophobia Mode To Keep Spiders At Bay
26.8.2024
If creepy-crawlies such as spiders give you the major heebie-jeebies, the latest quality-of-life feature in World of Warcraft: The War Within will come as something of a relief. The newly added Arachnophobia Mode allows those of us who would rather keep the spiders at bay a shot at enjoying...
Nexo Mastercard Adds Credit and Debit Toggle to Optimize Crypto Usage
1.9.2023
Nexo has introduced a new “Dual Mode” feature on its cryptocurrency Mastercard, allowing users to switch between debit and credit functions to optimize cryptocurrency spending. Nexo Unveils Dual Mode Card Capabilities to Streamline Crypto Payments Nexo‘s new feature enables...
How to Make a Pure CSS 3D Package Toggle
12.1.2022
You know how you can get cardboard boxes that come totally flat? You fold ‘em up and tape ‘em to make them into a useful box. Then when it’s time to recycle them, you cut them back apart to flatten …
How to Make a Pure CSS 3D Package Toggle originally published on CSS-Tricks. You should...
CSS “decorations”
22.11.2021
A reader wrote to me the other day asking about this bit of CSS they came across in Wikipedia’s Common.css:
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
}
What’s that @noflip business? That’s...
Other Looks at the Conditional Border Radius Trick
13.11.2021
Remember when Ahmad Shadeed wrote about that border-radius “toggle” he found in Facebook’s CSS? It was interesting! I covered it. A few weeks after that surge of linkage, a couple of articles came out digging into it a little deeper. …
The post Other Looks at...
kbar
15.9.2021
It’s not every day that a new pattern emerges across the web, but I think cmd + k is here to stay. It’s a keyboard shortcut that usually pops open a search UI and it lets you toggle settings on …
The post kbar appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter
Body Toggle
6.7.2021
I appreciate the clarity of this trick that Mikael Ainalem posted over on Reddit:
It’s a one-liner that toggles the class on the <body> so you can mock up different states and toggle between them on click.
<body onclick="this.classList.toggle("active");"
Could …
The post...
Links on Accessibility
7.6.2021
Show/Hide password accessibility and password hints tutorial — Nicolas Steenhout goes deep on <input type="password"> accessibility. For one thing, being able to toggle it to type="text" should be possible, while announcing, politely, the change. But also, put the password hints...
Collective #656
8.4.2021
Swipey image grids * Kaboom!!! * Web Browser Engineering * An accessible toggle
The post Collective #656 appeared first on Codrops
The CSS Custom Property Toggle Trick
29.10.2020
Back in July 2020, I got an email from James0x57 (I always try to refer to people by their name, but I think I get the sense they prefer to go by screen name) that says:
The entire world of branching conditional logic and bulk feature toggling for custom CSS properties is possible and only exists...
A little bit of plain Javascript can do a lot
8.7.2020
Julia Evans:
I decided to implement almost all of the UI by just adding & removing CSS classes, and using CSS transitions if I want to animate a transition.
An awful lot of the JavaScript on sites (that aren’t otherwise entirely constructed from JavaScript) is click the thing...
In-Browser Performance Linting With Feature Policies
26.2.2020
Here’s a neat idea from Tim Kadlec. He uses the Modheader extension to toggle custom headers in his browser. It also lets him see when images are too big and need to be optimized in some way. This is a great way to catch issues like this in a local environment because browsers will throw an error...
Creating a Details Element That Opens But Never Closes
15.2.2020
The <details> and <summary> elements in HTML are useful for making content toggles for bits of text. By default, you see the <summary> element with a toggle triangle (▶︎) next to it. Click that to expand the rest of the text inside the <details> element.
But...
Custom Styling Form Inputs With Modern CSS Features
7.2.2020
It’s entirely possible to build custom checkboxes, radio buttons, and toggle switches these days, while staying semantic and accessible. We don’t even need a single line of JavaScript or extra HTML elements! It’s actually gotten easier lately than it has been in the past. Let’s take a look.
Here’s...
The Ultimate Guide to Dark Mode for Email Marketers
7.1.2020
On the regular web (I suppose) we handle "dark mode" with the CSS prefers-color-scheme media query. But, and to nobody's surprise, it's way weirder in the land of HTML email. The weirdness is that across different email clients, they handle the dark mode thing differently, starting with the fact...
A Dark Mode Toggle with React and ThemeProvider
25.9.2019
I like when websites have a dark mode option. Dark mode makes web pages easier for me to read and helps my eyes feel more relaxed. Many websites, including YouTube and Twitter, have implemented it already, and we’re starting to see it trickle onto many other sites as well.
In this tutorial, we’re...
WDRL — Edition 269: Shaping up, Doing well while doing good, Single toggle buttons and the Illusion of control
19.7.2019
Hey,
it’s been already four weeks since the last edition. I’ve been on vacation for two weeks and around that, as many of you probably can relate, work is crazy. Before going off you have to finish things and when you come back, you’re overwhelmed by what happend during your absence. And...
Tabs: It’s Complicated™
19.4.2019
I've said before one quick and powerful thing you can learn as a front-end developer just getting starting with JavaScript is changing classes.
const button = document.querySelector(".my-button");
const element = document.querySelector(".content");
button.addEventListener("click", function()...
Using <details> for Menus and Dialogs is an Interesting Idea
21.3.2019
One of the most empowering things you can learn as a new front-end developer who is starting to learn JavaScript is to change classes. If you can change classes, you can use your CSS skills to control a lot on a page. Toggle a class to one thing, style it this way, toggle to another class...