💡 CSS Tip!
Add a gradient overlay above an existing background using one line of code
✅ No extra element & No pseudo-element
✅ No need to update the background property
Demo: via
@CodePen
#CSS
What kind of CSS loader are you?
⚫️The Dots
⬛️The Bars
Why not both at the same time. Check the below single-div collection "The Dots vs The Bars"👇
One div = one loader
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Extend the background of an element outside of its container to cover the full screen width
✅ No extra element
✅ No pseudo-element
✅ No overflow issue
✅ Only 2 CSS declarations
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Add an underline to your title and extend it to the right edge of the screen whatever the element/container size
✅ No extra element
✅ No pseudo-element
✅ No overflow issue
✅ Only 1 CSS property
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Make your container fill all the screen height
✅ No cascading `height:100%`
✅ No side effects of the `100vh`
✅ Works with the default margin of <body>
✅ No overflow issue. The height will grow to fit the content.
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Make an element stay at the top/right corner of your responsive grid using one instruction.
👉 `grid-area: 1/auto/auto/-1` ( grid-row-start:1;grid-column-end:-1)
The element can be anywhere in your HTML code.
Demo: via
@CodePen
#CSS
Geometry + CSS = Magic loaders 🪄
Check the below collection of CSS-only loaders 👇
✅ Only one <div> per loader, nothing more!
Demo: via
@CodePen
Pick your favorite one!
#CSS
Here is a simple CSS Trick to smoothly stop the rotation of your element on hover.
The animation will look more natural, and you avoid breaking your element with an abrupt stop!
The rotation will resume slowly on mouse-out as well.
Do you want to accelerate the rotation of your element on hover?
Here is a simple CSS trick using animation composition👇
Only one animation and a few lines of code are needed.
💡 CSS Tip!
One line of code that looks strange and confusing. You may think it's not even CSS but it will save you many times in the future!
It will make sure the width of your element is always an integer! No more decimal and rounding issues!
"width: auto" with an upgrade 😎
💡 CSS Tip!
Turn a simple input into single-digit inputs using a few lines of CSS.
✅ No extra element (only one input element)
✅ Less than 15 CSS declarations
✅ Optimized with CSS variables
Demo: via
@CodePen
💡CSS Tip!
Cut the corners of any element (circular shapes). Only one gradient is required for the 4 corners!
It's responsive and easy to adjust using CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Add a nice hover effect to your profile picture using a minimalist code
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ Less than 20 declarations
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
New CSS Project! 🥳
👉 👈
The Ultimate Collection of CSS-Only shapes
✅ Single-element implementation
✅ Modern & Optimized CSS code
✅ Easy to customize
✅ One click to copy the code
💡 CSS Tip!
Create a corner-only border around any element using only background properties (no Pseudo, no SVG, no extra element). You can also animate it!
Demo: via
@CodePen
💡 CSS Tip!
Create a simple but unexpected hover effect using a few lines of code
✅ No extra element & No pseudo element
✅ Only background properties
✅ Less than 10 declarations
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
📝 New CSS Article!
Do you want to explore some new CSS features? Check my latest article at
@smashingmag
👉
CSS Mask, @property, Math, etc. A lot of fun 🤩
Demo (featuring
@LeaVerou
and
@Una
): via
@CodePen
#CSS
💡 CSS Tip!
Add a fancy "Pop out" hover effect to your avatar using modern CSS 😍
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ Powered by the future of CSS (mask, @property, CSS variables and a lot of math)
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Use the round() function and create a fluid typography with a discrete function instead of a continuous one.
Define the step and get precise values within a specific range. Useful if you have some calculation using the "em" unit. No more rounding issue!
🎨 CSS Art
I am adding a demon slayer to the list. Take a deep breath and say hello to 𝗧𝗮𝗻𝗷𝗶𝗿𝗼 𝗞𝗮𝗺𝗮𝗱𝗼 ⚔️
Demo: via
@CodePen
✅ A CSS-only illustration (No images and No SVG)
Find more at
#CSS
#cssart
#DemonSlayer
💡 CSS Tip!
Use @counter-style to customize your <ol> list with a simple code
✅ No extra markup
✅ No pseudo-element
✅ No need for counter()
✅ Keep the default browser algorithm
Demo: via
@CodePen
#CSS
💡CSS Tip!
Using the new relative color syntax, you can easily extract the R,G,B channels of any color and use them as separate colors.
Useful when you want to do some color manipulation.
💡 CSS Tip!
Add a fancy "Pop out" hover effect to your avatar using modern CSS 😍
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ Powered by the future of CSS (mask, @property, CSS variables and a lot of math)
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Add a nice hover effect to your profile picture using a minimalist code
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ Less than 20 declarations
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
💡CSS Tip!
Create a CSS-only Pie Chart using one element and a compact code. You can have rounded edges and animation (Only Chromium browser support this kind of animation to date).
Easy to update using CSS variables.
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a dynamic line separator that switch from horizontal to vertical
✅ No media query
✅ Depend on the container width (not the screen width)
✅ Control when the switch will occur
Demo via
@CodePen
Based on the idea of
@shadeed9
👇
#CSS
CSS Tip 💡
Use a dynamic line separator that changes from horizontal to vertical depending on flex-direction. No need for width or height. Just a stretched CSS border!
Details:
Here is my idea for the inverted border-radius layout 👇
Demo: via
@CodePen
Using mask to have transparency. A minimal HTML with no pseudo-element and some CSS variables to control everything (the gap, the radius, etc)
#CSS
Are you looking for a simple loader? The below collection is for you 👇
Demo: via
@CodePen
✅ 1 <div> per loader
✅ 0 pseudo element
✅ 1 declared gradient per loader
✅ 1 value to control the size
✅ 1 value to control the color
#CSS
💡CSS Tip!
Create a plus symbol ➕ or a cross symbol ✖️ using only one gradient (no Pseudo element, no SVG, no extra element).
You can easily adjust the size and coloration!
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Add a nice hover effect to your profile picture using a minimalist code
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ Less than 20 declarations
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Add a cool hover effect to your images using a few lines of code
✅ No extra element (only the <img> tag)
✅ No pseudo element
✅ Using only the outline property
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Use Modern CSS to write Better CSS! A lot of new features can help you optimize your code and reduce redundancy.
✅ CSS Nesting
✅ CSS Variables
✅ Media Query range features
⬇️ Old Code New Code ⬇️
🎉 New CSS Project 🎉
It took me a while, but I finally collected all my CSS-only loaders into one place!🥳
👉 👈
The Biggest Collection of Loading Animations. More than 500 single-element CSS loaders.
✅ One-Click to copy
Which one do you like?
#CSS
💡 CSS Tip!
I told you that, using 2 CSS declarations, we can extend the background of an element outside of its container but we can still do better!
Demo: via
@CodePen
Full credit to
@SelenIT2
for this sorcery 🧙♂️
#CSS
💡 CSS Tip!
Extend the background of an element outside of its container to cover the full screen width
✅ No extra element
✅ No pseudo-element
✅ No overflow issue
✅ Only 2 CSS declarations
Demo: via
@CodePen
#CSS
💡 CSS Tip!
The smallest code to create a simple Tooltip Shape
✅ One element (No pseudo-elements)
✅ Only 2 CSS Properties
✅ Optimized with CSS Variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Add a fancy 3D effect to your image with a simple code
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ No JavaScript
✅ Perfect 3D illusion on hover 🤩
Demo: via
@CodePen
#CSS
💡 CSS Tip!
A simple design for your checkbox with a nice animation on click.
✅ No extra element (only the <input> tag)
✅ No pseudo-elements
✅ One value to control the size
✅ Less than 15 CSS declarations
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a CSS-only "Back To Top" button with a simple code
✅ 0 JavaScript
✅ Control when the button appears
✅ Smooth scroll on click
✅ Powered by CSS grid and sticky position
Demo: via
@CodePen
Full explanation 👉
💡 CSS Tip!
Create a simple button with a cool effect
✅ One element (the <button> tag)
✅ No duplicated text
✅ No pseudo element
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a circular dashed border with full control over the dashes. Only one element and a few lines of code are required.
Simply update the CSS variables to control the design of the border.
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Apply a zoom effect to your image with a few lines of code:
✅ No extra element (only the <img> tag)
✅ No duplicated images
✅ Only 3 properties
✅ Easy to adjust using CSS variables
Demo: via
@CodePen
#CSS
min() or max()? You always struggle to know which one to use and you end up trying both until one of them works.
💡 Here is a figure to help you decide when to use them
You start with clamp() then:
- when you remove max, you use max()
- when you remove min, you use min()
💡 I shared a lot of CSS Tips so I decided to put everything in a website for easy finding.
👉 👈
A simple website powered by
@eleven_ty
with more than 60 CSS Tips to date.
Want an RSS Feed for the future Tips? Here you go:
#CSS
💡 CSS Tip!
Did you ever wanted to slow down a rotating element on mouse hover? You can easily do it with a simple code:
✅ No extra element
✅ No pseudo-element
✅ One animation
✅ Easy to control with CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
A fancy hover effect using only background properties.
No extra elements, No pseudo elements and a few lines of CSS.
Demo: via
@CodePen
#CSS
💡 CSS Tip!
A 3D sphere with a filling animation using only CSS? Yes it's possible! 🔮
✅ One element
✅ No JavaScript & No SVG
✅ Easy to control using CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
To target the html element, you either use "html {}" or ":root {}" but thanks to CSS nesting you can simply use "& {}"
When used alone, the nesting selector will match the root element! A one-character selector 🤯
⚠️ It has a lower specificity than html and :root
💡 CSS Tip!
Add an infinite shadow to your image in any direction using a few lines of code
✅ No extra element (only the <img> tag)
✅ No pseudo-elements
✅ Only 2 CSS properties
✅ Works with rounded corners
Demo: via
@CodePen
#CSS
💡CSS Tip!
Use modern CSS tricks to create fancy range sliders with a little code
✅ No extra element (only the <input> element)
✅ Optimized with CSS variables
✅ Transparent gap around the thumb
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a "Yes/No" buttons with fancy shapes and a cool hover effect
✅ Minimal HTML code (2 <button> inside a container)
✅ No pseudo element
✅ Optimized with CSS variables
✅ Keyboard accessible*
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Do you want to add a gradient overlay above your background but you cannot edit the background property, add an extra element or use pseudo-element? Do it with border-image!
✅ Only one line of code is needed 🤩
Demo: via
@CodePen
#CSS
💡CSS Tip!
Create horizontal lines around your titles without any complex code. No pseudo element, No extra element, No images, No overflow issue.
You can easily control everything using CSS variables.
Demo: via
@CodePen
#CSS
💡CSS Tip!
Cut the corners of your element with custom shapes. One code for multiple shapes.
Change a few CSS variables to control the shape.
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a fully responsive grid of Hexagon shapes (and more!)
✅ No media query
✅ No JavaScript
✅ Minimal HTML code
✅ Easy to control using CSS variables
👉 👈
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a CSS-only "Blob" loader using a few lines of code
✅ 1 element
✅ No SVG
✅ Less than 15 declarations
✅ 2 keyframes
Demo: via
@CodePen
#CSS
🎨 CSS Art
After Luffy and the Colossal Titan, another famous anime character. The one and only ... 𝗚𝗼𝗸𝘂 💪
Demo: via
@CodePen
If you missed my previous CSS Arts, find them in one place
👉 👈
#CSS
#DragonBallZ
#Goku
💡 CSS Tip!
Add a cool hover effect to your images with a few lines of code
✅ No extra element (only the <img> tag)
✅ Only 2 properties (mask and filter)
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Create a simple checkbox with a cool animation using a few lines of code
✅ No extra element (only the <input> tag)
✅ No pseudo-element
✅ No Keyframes
✅ One variable to control the size
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Do you want to select the first and last element with a specific class? It's possible and you can do it using 2 different methods!
The browser support will soon be good so save them for your next project 👍
Demo: via
@CodePen
#CSS
I am joining the game and trying the new View Transitions on CSS Tip
👉 👈
Yes, what you see are Zig-Zag edges 👀
Open your Chrome, activate the "viewTransition" flags and have fun! 🤩
#CSS
Really happy to see stuff like this. It's hard getting feedback on web APIs, and there are few second chances, but it seems like we did ok on this one.
Loads more to do to get the MPA bit over the line, but the folks working on it are smart as fuck. They'll do good.
💡 CSS Tip!
Create a simple Hamburger menu with a cool animation
✅ One element
✅ No keyframes
✅ Easy to update using CSS variables
✅ Support keyboard navigation
Demo: via
@CodePen
#CSS
CSS Nesting is cool and using the "&" is a lifesaver BUT be careful. There's a gotcha!
⚠️ "&" in CSS is different from the one in Sass ⚠️
Your Sass code won't work the same way if you use it as a CSS code.
Yes, it's counter-intuitive but keep reading to understand why 👇
💡 CSS Tip!
Create a Speech Bubble using a few lines of code
✅ One element
✅ No pseudo-element
✅ Only 3 properties
✅ Optimized with CSS variables
Demo: via
@CodePen
#CSS
I did it! 100 Unique CSS Patterns 🤩
👉 👈
One of the biggest collection of CSS patterns ever!
✅ One-click to copy/paste
✅ One value to control the size
✅ Optimized with CSS variables
Which one is your favorite? Tell me in the comments 👇
#CSS
💡 CSS Tip!
Create a Pulse loader with a few lines of code:
✅ 1 element
✅ 1 keyframes
✅ 11 declarations
Demo: via
@CodePen
⚠️ Warning ⚠️: You may get hypnotized if you spend too much time in front of it!😵💫
#CSS
💡 CSS Tip!
Create a matrix of cubes using only one <div>. Yes it's possible!
You can easily control everything using CSS variables.
Demo: via
@CodePen
#CSS
After the "Ultimate Collection of CSS Shapes". It's time for "The Modern Guide for making CSS Shapes". 🤩
via
@smashingmag
A huge compilation of many CSS Tricks I have been using since years in this guide.
Enjoy reading my 100th CSS Article! 🥳
New CSS Project! 🥳
👉 👈
The Ultimate Collection of CSS-Only shapes
✅ Single-element implementation
✅ Modern & Optimized CSS code
✅ Easy to customize
✅ One click to copy the code
💡 CSS Tip!
Use conic-gradient() and the new color interpolation to create a color wheel 🤩
✅ Tell the browser to take the longer route between red and red
❌ No complex color combination
Demo: via
@CodePen
#CSS
💡CSS Tip!
Create a CSS-only progress bar with a dynamic coloration. The color change based on the value (No JavaScript, No specific CSS selector)
Demo: via
@CodePen
#CSS
How many ways of "Centering in CSS" do you know? 10, 20? Flexbox, Grid?
What if I tell you there is a hidden way to center your content without writing any CSS!?
1 element + 2 attributes = Centered without CSS 😈
As a bonus, you get a free border around your element 🥳
💡 CSS Tip!
Add a reveal animation to your image with a simple and nice hover effect
✅ No extra element (only the <img> tag)
✅ No pseudo-element
✅ 10 CSS declarations
Demo: via
@CodePen
#CSS
A realistic 3D Card hover effect using only CSS 🤩
Demo: via
@CodePen
✅ Minimal HTML
✅ Responsive
✅ Featuring the best video game ever
Inspired by
@gggayane
👇
#CSS
🎨 CSS Art
The Tanjiro I made was getting nervous and start screaming: "Nezuko!! Where is Nezuko?!"
𝗡𝗲𝘇𝘂𝗸𝗼 is here 👇
Demo: via
@CodePen
✅ A CSS-Only illustration (No image, No SVG)
More at
#CSS
#CSSart
#DemonSlayer
🎨 CSS Art
I am adding a demon slayer to the list. Take a deep breath and say hello to 𝗧𝗮𝗻𝗷𝗶𝗿𝗼 𝗞𝗮𝗺𝗮𝗱𝗼 ⚔️
Demo: via
@CodePen
✅ A CSS-only illustration (No images and No SVG)
Find more at
#CSS
#cssart
#DemonSlayer
🎮 CSS Game!
IE is almost dead! Here is a Game to kill it forever ☠️ but keep Chrome alive!
A CSS only FPS:
✅ 0 JS
✅ 0 image
✅ 0 <input>
⚠️ Chromium only
Demo: via
@CodePen
Show me your best attempt 👇
(❌No screenshot 📽️ Only recording)
#CSS
I had to try it 👇 and it was, indeed, a fun experimentation!
✅ Minimal HTML
✅ CSS-only
✅ No magic numbers
✅ Works with any number of elements
Demo: via
@CodePen
#CSS
CSS-only fun!
Had a rough draft of this sitting around for a while that was okay, but the first hover moved in from the left, and when you stopped hovering it moved out to the left...
Much happier with it now, and will be recording a video on it next week probably 🙂
💡 CSS Tip!
Create a simple CSS Toggle Switch using only background properties.
No pseudo element, No extra element, No images. A few lines of code and one variable to adjust.
Demo: via
@CodePen
#CSS
💡 CSS Tip!
Use the :has() selector and style your container based on its number of elements (direct children)
Demo: via
@CodePen
⚠️ It doesn't count text nodes. Only tags!
#CSS
CSS Mask + Trigonometric functions + CSS variables + @property = A magic result! 🤩
✅ A fancy animation using only the <img> tag!
Demo: via
@CodePen
idea by
@argyleink
#CSS
💡 CSS Tip!
Create a simple grid of images with a cool zoom effect on hover.
✅ Minimal HTML code
✅ No JavaScript
✅ No Complex selectors
✅ Less than 20 CSS declarations
✅ Easy to control using CSS variables
Demo: via
@CodePen
#CSS
@jensimmons
As an active contributor on StackOverflow (more than 6000 CSS answers to date), the issue is that people want to make things working without understanding the "why". It does work with many language where you can copy/past portion of codes and put them together but not with CSS.