Search
Everything You Need to Know About the Gap After the List Marker
2.3.2023
I was reading “Creative List Styling” on Google’s web.dev blog and noticed something odd in one of the code examples in the ::marker section of the article. The built-in list markers are bullets, ordinal numbers, and letters. The ::marker pseudo-element …
Everything You Need to Know About...
Fancy Image Decorations: Masks and Advanced Hover Effects
21.10.2022
Welcome to Part 2 of this three-part series! We are still decorating images without any extra elements and pseudo-elements. I hope you already took the time to digest Part 1 because we will continue working with a lot of gradients …
Fancy Image Decorations: Masks and Advanced Hover Effects...
Cool Hover Effects That Use Background Properties
27.4.2022
A while ago, Geoff wrote an article about a cool hover effect. The effect relies on a combination of CSS pseudo-elements, transforms, and transitions. A lot of comments have shown that the same effect can be done using background …
Cool Hover Effects That Use Background Properties originally...
Web Component Pseudo-Classes and Pseudo-Elements are Easier Than You Think
28.2.2022
We’ve discussed a lot about the internals of using CSS in this ongoing series on web components, but there are a few special pseudo-elements and pseudo-classes that, like good friends, willingly smell your possibly halitotic breath before you go …
Web Component Pseudo-Classes...
7 Practical Uses for the ::before and ::after Pseudo-Elements in CSS
21.9.2021
CSS ::before and ::after pseudo-elements allow you to insert “content” before and after any non-replaced element (e.g. they work on a <div> but not an <input>). This effectively allows you to show something on a web page that might …
The post 7 Practical Uses...
CSS Pseudo Commas
30.8.2021
A bonafide CSS trick if there ever was one! @ShadowShahriar created a CodePen demo that uses pseudo-elements to place commas between list items that are displayed inline, and the result is a natural-looking complete sentence with proper punctuation.
CodePen Embed…
The post CSS Pseudo Commas...
Creating Colorful, Smart Shadows
4.5.2021
A bona fide CSS trick from Kirupa Chinnathambi here. To match a colored shadow with the colors in the background-image of an element, you inherit the background in a pseudo-element, kick it behind the original, then blur and filter it. …
The post Creating Colorful, Smart Shadows appeared...
Simple CSS Line Hover Animations for Links
10.2.2021
A couple of simple & subtle CSS-based line hover animations for links.
The post Simple CSS Line Hover Animations for Links appeared first on Codrops
Pseudo-elements in the Web Animations API
14.5.2020
To use the Web Animations API (e.g. el.animate()) you need a reference to a DOM element to target. So, how do you use it on pseudo-elements, which don’t really offer a direct reference? Dan Wilson covers a (newish?) part of the API itself:
const logo...
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...
Re-creating the ‘His Dark Materials’ Logo in CSS
11.1.2020
The text logo has a slash cut through the text. You set two copies on top of one another, cropping both of them with the clip-path property.
What's interesting to me is how many cool design effects require multiple copies of an element to do something cool. To get the extra copy, at least with...
css.gg
18.12.2019
I'm not sure what to call these icons from Astrit Malsija. The title is "500+ CSS Icons, Customizable, Retina Ready & API" and the URL is "css.gg" but they aren't really named anything.
Anyway, their shtick is:
The 🌎's first icon library designed by code.
The idea is that they don't...
Breakout Buttons
4.10.2019
Andy covers a technique where a semantic <button> is used within a card component, but really, the whole card is clickable. The trick is to put a pseudo-element that goes beyond the button, covering the entire card. The tradeoff is that the pseudo-element sits on top of the text, so text...
Various Methods for Expanding a Box While Preserving the Border Radius
6.9.2019
I've recently noticed an interesting change on CodePen: on hovering the pens on the homepage, there's a rectangle with rounded corners expanding in the back.
Expanding box effect on the CodePen homepage.
Being the curious creature that I am, I had to check how this works! Turns out, the rectangle...
Nested Gradients with background-clip
28.8.2019
I can't say I use background-clip all that often. I'd wager it's hardly ever used in day-to-day CSS work. But I was reminded of it in a post by Stefan Judis, which consistently was itself a learning-response post to a post over here by Ana Tudor.
Here's a quick explanation.
You've probably seen...
Creating a Maintainable Icon System with Sass
28.8.2019
One of my favorite ways of adding icons to a site is by including them as data URL background images to pseudo-elements (e.g. ::after) in my CSS. This technique offers several advantages:
They don't require any additional HTTP requests other than the CSS file.
Using the background-size property...
Weekly Platform News: CSS ::marker pseudo-element, pre-rendering web components, adding Webmention to your site
18.7.2019
In this week's roundup: datepickers are giving keyboard users headaches, a new web component compiler that helps fight FOUC, we finally get our hands on styling list item markers, and four steps to getting webmentions on your site.
The post Weekly Platform News: CSS ::marker pseudo-element...
A Little Reminder That Pseudo Elements are Children, Kinda.
8.7.2019
Here's a container with some child elements:
<div class="container">
<div>item</div>
<div>item</div>
<div>item</div>
</div>
If I do:
.container::before {
content: "x"
}
I'm essentially doing:
<div class="container">
...
Restricting a (pseudo) element to its parent’s border-box
2.7.2019
Have you ever wanted to ensure that nothing of a (pseudo) element gets displayed outside its parent's border-box? In case you're having trouble picturing what that looks like, let's say we wanted to get the following result with minimal markup and avoiding brittle CSS.
The desired result.
This...
Text Wrapping & Inline Pseudo Elements
27.2.2019
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...