📚 1. Python
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development, data analysis, machine learning, scripting
⦁ Key Features: Easy readability, extensive libraries (e.g., NumPy, Pandas), strong community support.
📚 2. JavaScript
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development (frontend and backend), server-side applications (Node.js)
⦁ Key Features: Event-driven, prototype-based, supports asynchronous programming.
📚 3. Java
⦁ Type: High-level, compiled (to bytecode)
⦁ Use Cases: Enterprise applications, Android app development, backend systems
⦁ Key Features: Object-oriented, platform-independent (Java Virtual Machine), strong typing.
📚 4. C++
⦁ Type: Middle-level, compiled
⦁ Use Cases: System/software development, game development, performance-critical applications
⦁ Key Features: Object-oriented, low-level memory manipulation, templates for generic programming.
📚 5. C#
⦁ Type: High-level, compiled
⦁ Use Cases: Windows applications, game development (Unity), enterprise applications
⦁ Key Features: Object-oriented, integrates well with .NET framework, strong typing.
📚 6. Ruby
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development (Ruby on Rails), scripting
⦁ Key Features: Highly readable syntax, dynamic typing, focus on developer happiness.
📚 7. Go (Golang)
⦁ Type: High-level, compiled
⦁ Use Cases: Cloud services, distributed systems, microservices
⦁ Key Features: Concurrency support (goroutines), simplicity and clarity, strong standard library.
📚 8. Swift
⦁ Type: High-level, compiled
⦁ Use Cases: iOS and macOS development
⦁ Key Features: Type-safe, modern syntax, performance-oriented.
📚 9. PHP
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development, server-side scripting
⦁ Key Features: Easy integration with HTML, extensive use in web frameworks like Laravel.
📚 10. Rust
⦁ Type: High-level, compiled
⦁ Use Cases: System programming, performance-critical applications, safe concurrency
⦁ Key Features: Memory safety without garbage collection, strong static typing, modern syntax.
📚 11. Kotlin
⦁ Type: High-level, compiled
⦁ Use Cases: Android app development, server-side applications
⦁ Key Features: Interoperable with Java, concise syntax, null safety.
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development, data analysis, machine learning, scripting
⦁ Key Features: Easy readability, extensive libraries (e.g., NumPy, Pandas), strong community support.
📚 2. JavaScript
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development (frontend and backend), server-side applications (Node.js)
⦁ Key Features: Event-driven, prototype-based, supports asynchronous programming.
📚 3. Java
⦁ Type: High-level, compiled (to bytecode)
⦁ Use Cases: Enterprise applications, Android app development, backend systems
⦁ Key Features: Object-oriented, platform-independent (Java Virtual Machine), strong typing.
📚 4. C++
⦁ Type: Middle-level, compiled
⦁ Use Cases: System/software development, game development, performance-critical applications
⦁ Key Features: Object-oriented, low-level memory manipulation, templates for generic programming.
📚 5. C#
⦁ Type: High-level, compiled
⦁ Use Cases: Windows applications, game development (Unity), enterprise applications
⦁ Key Features: Object-oriented, integrates well with .NET framework, strong typing.
📚 6. Ruby
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development (Ruby on Rails), scripting
⦁ Key Features: Highly readable syntax, dynamic typing, focus on developer happiness.
📚 7. Go (Golang)
⦁ Type: High-level, compiled
⦁ Use Cases: Cloud services, distributed systems, microservices
⦁ Key Features: Concurrency support (goroutines), simplicity and clarity, strong standard library.
📚 8. Swift
⦁ Type: High-level, compiled
⦁ Use Cases: iOS and macOS development
⦁ Key Features: Type-safe, modern syntax, performance-oriented.
📚 9. PHP
⦁ Type: High-level, interpreted
⦁ Use Cases: Web development, server-side scripting
⦁ Key Features: Easy integration with HTML, extensive use in web frameworks like Laravel.
📚 10. Rust
⦁ Type: High-level, compiled
⦁ Use Cases: System programming, performance-critical applications, safe concurrency
⦁ Key Features: Memory safety without garbage collection, strong static typing, modern syntax.
📚 11. Kotlin
⦁ Type: High-level, compiled
⦁ Use Cases: Android app development, server-side applications
⦁ Key Features: Interoperable with Java, concise syntax, null safety.
Here are five advanced JavaScript techniques that can help enhance your coding skills and make your applications more efficient and maintainable:
📚 1. Closures
Closures are a function that retains access to its lexical scope, even when the function is executed outside that lexical scope. This feature can be used for data encapsulation, creating private variables, and implementing callback functions.
Example:
📚 2. Promises and Async/Await
Promises and the async/await syntax provide a powerful way to handle asynchronous operations in JavaScript. Promises represent a value that may be available now, or in the future, or never. Async/await provides a more synchronous way to work with promises for better readability.
Example:
📚 3. Higher-Order Functions
Higher-order functions are functions that take other functions as arguments or return functions as their results. They are fundamental to functional programming in JavaScript.
Example:
📚 4. Module Pattern
The Module Pattern is used to create private and public members in JavaScript, helping to organize code and maintain encapsulation. It uses closures to keep variables private while exposing public methods.
Example:
📚 5. Debouncing and Throttling
Debouncing and throttling are techniques to control the rate at which a function is executed, useful for optimizing performance, especially in event-driven environments.
⦁ Debouncing ensures a function runs only after a certain period of inactivity.
Example of Debouncing:
⦁ Throttling ensures a function executes at most once in a specified period.
Example of Throttling:
These techniques are essential for creating efficient, maintainable, and scalable JavaScript code, particularly in larger applications. Understanding and applying these concepts will significantly enhance your JavaScript programming skills.
📚 1. Closures
Closures are a function that retains access to its lexical scope, even when the function is executed outside that lexical scope. This feature can be used for data encapsulation, creating private variables, and implementing callback functions.
Example:
function makeCounter() {
let count = 0;
return function() {
count += 1;
return count;
};
}
const counter = makeCounter();
console.log(counter()); // 1
console.log(counter()); // 2
📚 2. Promises and Async/Await
Promises and the async/await syntax provide a powerful way to handle asynchronous operations in JavaScript. Promises represent a value that may be available now, or in the future, or never. Async/await provides a more synchronous way to work with promises for better readability.
Example:
function fetchData() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve("Data received!");
}, 1000);
});
}
async function getData() {
const result = await fetchData();
console.log(result);
}
getData(); // After 1 second, "Data received!" will be logged
📚 3. Higher-Order Functions
Higher-order functions are functions that take other functions as arguments or return functions as their results. They are fundamental to functional programming in JavaScript.
Example:
function map(arr, callback) {
const result = [];
for (let i = 0; i < arr.length; i++) {
result.push(callback(arr[i], i, arr));
}
return result;
}
const nums = [1, 2, 3];
const squares = map(nums, x => x * x);
console.log(squares); // [1, 4, 9]
📚 4. Module Pattern
The Module Pattern is used to create private and public members in JavaScript, helping to organize code and maintain encapsulation. It uses closures to keep variables private while exposing public methods.
Example:
const Module = (function() {
let privateVar = 'I am private';
return {
publicMethod: function() {
console.log(privateVar);
},
};
})();
Module.publicMethod(); // "I am private"
📚 5. Debouncing and Throttling
Debouncing and throttling are techniques to control the rate at which a function is executed, useful for optimizing performance, especially in event-driven environments.
⦁ Debouncing ensures a function runs only after a certain period of inactivity.
Example of Debouncing:
function debounce(func, wait) {
let timeout;
return function() {
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(this, arguments), wait);
};
}
const handleResize = debounce(() => {
console.log('Window resized!');
}, 200);
window.addEventListener('resize', handleResize);
⦁ Throttling ensures a function executes at most once in a specified period.
Example of Throttling:
function throttle(func, limit) {
let lastFunc;
let lastRan;
return function() {
const context = this;
const args = arguments;
if (!lastRan) {
func.apply(context, args);
lastRan = Date.now();
} else {
clearTimeout(lastFunc);
lastFunc = setTimeout(function() {
if ((Date.now() - lastRan) >= limit) {
func.apply(context, args);
lastRan = Date.now();
}
}, limit - (Date.now() - lastRan));
}
};
}
const log = throttle(() => {
console.log('Throttled function executed');
}, 1000);
window.addEventListener('scroll', log);
These techniques are essential for creating efficient, maintainable, and scalable JavaScript code, particularly in larger applications. Understanding and applying these concepts will significantly enhance your JavaScript programming skills.
CodePen Blog
Chris’ Corner: Color Accessibility
I’ve been a bit sucked into the game Balatro lately. Seriously. Tell me your strategies. I enjoy playing it equally as much lately as unwinding watching streamers play it on YouTube. Balatro has a handful of accessibility features. Stuff like slowing down or turning off animations and the like. I’m particularly interested one of the checkboxes below though: https://blog.codepen.io/wp-content/uploads/2025/02/image-1024x471.png “High Contrast Cards” is one of the options. It’s a nice option to have, but I find it particularly notable because of it’s popularity. You know those streamers I mentioned? The all seem to have this option turned on. Interesting how an “accessibility feature” actually seems to make the game better for everybody. As in, maybe the default should be reversed or just not there at all, with the high contrast version being just how it is.
It reminds me about how half of Americans, particularly the younger generation, prefer having closed captioning on TV some or all of the time. An accessibility feature that they just prefer.
Interestingly, the high contrast mode in Balatro mostly focuses on changing colors. https://blog.codepen.io/wp-content/uploads/2025/02/image-1-1024x471.png If you don’t suffer from any sort of colorblindness (like me? I think?) you’ll notice the clubs above are blue, which differentiates them from the spades which remain black. The hearts and clubs are slightly differentiated with the diamonds being a bit more orange than red.
Is that enough? It’s enough for many players preferring it, likely preventing accidentally playing a flush hand with the wrong suits, for example. But I can’t vouch for if it works for people with actual low vision or a type of color blindness, which is what I’d assume would be the main point of the feature. Andy Baio wrote a memorable post about colorblindness a few years ago called Chasing rainbows. There are some great examples in that post that highlight the particular type of colorblindness Andy has. Sometimes super different colors look a lot closer together than you’d expect, but still fairly distinct. Where sometimes two colors that are a bit different actually appear identical to Andy. https://blog.codepen.io/wp-content/uploads/2025/02/Screenshot-2025-02-24-at-7.57.24 AM-1024x679.png So maybe the Balatro colors are enough (lemme know!) or maybe they are not. I assume that’s why a lot of “high contrast” variations do more than color, they incorporate different patterns and whatnot. Which, fair enough, the playing cards of Balatro already do.
Let’s do a few more fun CSS and color related links to round out the week:
* Adam Argyle: A conic gradient diamond and okLCH — I’m always a little surprised at the trickery that conic gradients unlock. Whenever I think of them I’m like uhmmmmm color pickers and spinners I guess?
* Michelle Barker: Messing About with CSS Gradients — Layered gradients unlocking some interested effects and yet more trickery.
* Michelle Barker: Creating color palettes with the CSS color-mix() function — Sure,
* Keith Grant: Theme Machine — A nice take on going from choosing nice individual colors to crafting palettes, seeing them in action, and getting custom property output for CSS.
Chris’ Corner: Color Accessibility
I’ve been a bit sucked into the game Balatro lately. Seriously. Tell me your strategies. I enjoy playing it equally as much lately as unwinding watching streamers play it on YouTube. Balatro has a handful of accessibility features. Stuff like slowing down or turning off animations and the like. I’m particularly interested one of the checkboxes below though: https://blog.codepen.io/wp-content/uploads/2025/02/image-1024x471.png “High Contrast Cards” is one of the options. It’s a nice option to have, but I find it particularly notable because of it’s popularity. You know those streamers I mentioned? The all seem to have this option turned on. Interesting how an “accessibility feature” actually seems to make the game better for everybody. As in, maybe the default should be reversed or just not there at all, with the high contrast version being just how it is.
It reminds me about how half of Americans, particularly the younger generation, prefer having closed captioning on TV some or all of the time. An accessibility feature that they just prefer.
Interestingly, the high contrast mode in Balatro mostly focuses on changing colors. https://blog.codepen.io/wp-content/uploads/2025/02/image-1-1024x471.png If you don’t suffer from any sort of colorblindness (like me? I think?) you’ll notice the clubs above are blue, which differentiates them from the spades which remain black. The hearts and clubs are slightly differentiated with the diamonds being a bit more orange than red.
Is that enough? It’s enough for many players preferring it, likely preventing accidentally playing a flush hand with the wrong suits, for example. But I can’t vouch for if it works for people with actual low vision or a type of color blindness, which is what I’d assume would be the main point of the feature. Andy Baio wrote a memorable post about colorblindness a few years ago called Chasing rainbows. There are some great examples in that post that highlight the particular type of colorblindness Andy has. Sometimes super different colors look a lot closer together than you’d expect, but still fairly distinct. Where sometimes two colors that are a bit different actually appear identical to Andy. https://blog.codepen.io/wp-content/uploads/2025/02/Screenshot-2025-02-24-at-7.57.24 AM-1024x679.png So maybe the Balatro colors are enough (lemme know!) or maybe they are not. I assume that’s why a lot of “high contrast” variations do more than color, they incorporate different patterns and whatnot. Which, fair enough, the playing cards of Balatro already do.
Let’s do a few more fun CSS and color related links to round out the week:
* Adam Argyle: A conic gradient diamond and okLCH — I’m always a little surprised at the trickery that conic gradients unlock. Whenever I think of them I’m like uhmmmmm color pickers and spinners I guess?
* Michelle Barker: Messing About with CSS Gradients — Layered gradients unlocking some interested effects and yet more trickery.
* Michelle Barker: Creating color palettes with the CSS color-mix() function — Sure,
color-mix() is nice for a one-off where you’re trying to ensure contrast or build the perfect combo from an unknown other color, but it can also be the foundational tool for a system of colors.* Keith Grant: Theme Machine — A nice take on going from choosing nice individual colors to crafting palettes, seeing them in action, and getting custom property output for CSS.
Fascinating Facts About Web Development 🌍💻
1️⃣ The First Website Still Exists!
Tim Berners-Lee, the inventor of the World Wide Web, created the first website in 1991. You can still visit it here: info.cern.ch.
2️⃣ HTML is Not a Programming Language
Unlike JavaScript or Python, HTML is a markup language—it structures content but doesn’t perform logic-based operations.
3️⃣ JavaScript Runs Everywhere
Initially designed for web browsers, JavaScript is now used for server-side development (Node.js), mobile apps, AI, and even game development.
4️⃣ CSS Can Animate Without JavaScript
With CSS animations and transitions, you can create smooth effects without writing a single line of JavaScript.
5️⃣ The Web Has Over 1.5 Billion Websites
However, only about 200 million are actively maintained. The rest are inactive or abandoned.
6️⃣ Google Ranks Speed as a Factor
Websites that load faster than 2 seconds have a better chance of ranking higher on Google. Performance is key!
7️⃣ Most Users Leave a Slow Website in 3 Seconds
If your website takes too long to load, visitors will bounce—meaning they leave before interacting.
8️⃣ Mobile-First is the New Standard
More than 60% of web traffic comes from mobile devices, so responsive design isn’t optional—it’s essential.
9️⃣ Dark Mode Saves Battery
On OLED screens, dark mode can reduce power consumption by up to 60%, making it both stylish and energy-efficient.
🔟 Hackers Attack Every 39 Seconds
Security is crucial in web development. Using HTTPS, secure passwords, and firewalls helps protect websites from attacks.
Which fact surprised you the most? 🚀
1️⃣ The First Website Still Exists!
Tim Berners-Lee, the inventor of the World Wide Web, created the first website in 1991. You can still visit it here: info.cern.ch.
2️⃣ HTML is Not a Programming Language
Unlike JavaScript or Python, HTML is a markup language—it structures content but doesn’t perform logic-based operations.
3️⃣ JavaScript Runs Everywhere
Initially designed for web browsers, JavaScript is now used for server-side development (Node.js), mobile apps, AI, and even game development.
4️⃣ CSS Can Animate Without JavaScript
With CSS animations and transitions, you can create smooth effects without writing a single line of JavaScript.
5️⃣ The Web Has Over 1.5 Billion Websites
However, only about 200 million are actively maintained. The rest are inactive or abandoned.
6️⃣ Google Ranks Speed as a Factor
Websites that load faster than 2 seconds have a better chance of ranking higher on Google. Performance is key!
7️⃣ Most Users Leave a Slow Website in 3 Seconds
If your website takes too long to load, visitors will bounce—meaning they leave before interacting.
8️⃣ Mobile-First is the New Standard
More than 60% of web traffic comes from mobile devices, so responsive design isn’t optional—it’s essential.
9️⃣ Dark Mode Saves Battery
On OLED screens, dark mode can reduce power consumption by up to 60%, making it both stylish and energy-efficient.
🔟 Hackers Attack Every 39 Seconds
Security is crucial in web development. Using HTTPS, secure passwords, and firewalls helps protect websites from attacks.
Which fact surprised you the most? 🚀
Blocking text selection and screenshot functionality in HTML and CSS can be challenging, as users can always find ways around such measures, like using another device to take a screenshot. However, you can implement certain features to deter casual users from copying text or screenshots on your web page.
📚 Block Text Selection
You can use CSS to disable text selection. This can be done by applying the
Then, you can apply this class to the elements you want to protect:
📚 Block Right-Click Context Menu
You may also want to block the right-click context menu to further discourage users from copying content:
📚 Using a Transparent Overlay
You can use a transparent overlay that covers your content, which can help deter screenshot capturing:
And the associated CSS:
📚 Additional Considerations
1. Watermarking: If you are concerned about images, consider watermarking them to deter unauthorized use.
2. Web Application Limitations: Blocked actions are not foolproof; tech-savvy users will still find ways to bypass these restrictions. Blocking text selection or right-clicking may frustrate some users, as they may want to copy text for legitimate use.
3. Legal Notice: Consider placing a copyright notice or terms of service on your site, which legally protects your content.
4. JavaScript Disabling: Keep in mind that users can disable JavaScript, which would allow them to copy text as normal.
📚 Final Note
While these methods can make it more challenging to copy content, it's essential to remember that no solution is entirely foolproof. The best approach is often to accept that some level of copying may occur and focus on providing valuable, unique content instead.
📚 Block Text Selection
You can use CSS to disable text selection. This can be done by applying the
user-select property:.noselect {
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Edge */
}
Then, you can apply this class to the elements you want to protect:
<div class="noselect">
This text cannot be selected or copied.
</div>
📚 Block Right-Click Context Menu
You may also want to block the right-click context menu to further discourage users from copying content:
<script>
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
</script>
📚 Using a Transparent Overlay
You can use a transparent overlay that covers your content, which can help deter screenshot capturing:
<div class="overlay"></div>
<div class="content">
This is the content you want to protect.
</div>
And the associated CSS:
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.5); /* Semi-transparent */
z-index: 10; /* Higher than content */
pointer-events: none; /* Let clicks go through */
}
.content {
position: relative; /* Keep it above the overlay */
z-index: 20; /* Higher than overlay */
}
📚 Additional Considerations
1. Watermarking: If you are concerned about images, consider watermarking them to deter unauthorized use.
2. Web Application Limitations: Blocked actions are not foolproof; tech-savvy users will still find ways to bypass these restrictions. Blocking text selection or right-clicking may frustrate some users, as they may want to copy text for legitimate use.
3. Legal Notice: Consider placing a copyright notice or terms of service on your site, which legally protects your content.
4. JavaScript Disabling: Keep in mind that users can disable JavaScript, which would allow them to copy text as normal.
📚 Final Note
While these methods can make it more challenging to copy content, it's essential to remember that no solution is entirely foolproof. The best approach is often to accept that some level of copying may occur and focus on providing valuable, unique content instead.
🚀 AI is Already Used by Billions! 🤖
AI is no longer the future—it’s the present! With billions of users relying on AI daily, how is it shaping our world? 🌎
🔥 Current Impacts:
✅ Efficiency Boom – AI automates work, boosting productivity.
✅ New Industries – AI-driven jobs and businesses are growing.
❌ Job Displacement – Many roles are being replaced by automation.
❌ Over-Reliance on AI – Critical thinking and creativity are at risk.
⚖️ The Big Question:
Is AI making life easier or slowly replacing human intelligence? 🤔
💬 What do you think? Is AI helping or harming society? Drop your thoughts below! 👇
AI is no longer the future—it’s the present! With billions of users relying on AI daily, how is it shaping our world? 🌎
🔥 Current Impacts:
✅ Efficiency Boom – AI automates work, boosting productivity.
✅ New Industries – AI-driven jobs and businesses are growing.
❌ Job Displacement – Many roles are being replaced by automation.
❌ Over-Reliance on AI – Critical thinking and creativity are at risk.
⚖️ The Big Question:
Is AI making life easier or slowly replacing human intelligence? 🤔
💬 What do you think? Is AI helping or harming society? Drop your thoughts below! 👇
🚀 Developers, this is a GAME-CHANGER! 🤯💻
Ever wished for an AI coding assistant that truly understands your code? Meet Qodo Gen – your smartest coding partner that helps you write cleaner, faster, and error-free code! 🔥
⚡ Code smarter, not harder – Get AI-powered suggestions
🛠️ No more debugging nightmares – Catch issues before they break your code
💡 Seamless IDE integration – Work without interruptions
💯 Upgrade your coding workflow now!
🔗 Try it out here 👉 https://www.qodo.ai/ 🚀
Ever wished for an AI coding assistant that truly understands your code? Meet Qodo Gen – your smartest coding partner that helps you write cleaner, faster, and error-free code! 🔥
⚡ Code smarter, not harder – Get AI-powered suggestions
🛠️ No more debugging nightmares – Catch issues before they break your code
💡 Seamless IDE integration – Work without interruptions
💯 Upgrade your coding workflow now!
🔗 Try it out here 👉 https://www.qodo.ai/ 🚀
11th Physical Chemistry (1).html
84.7 KB
Problem: The .second-summary class was missing(in :Mathematics By VG Sir), causing the animation not to work. It has been fixed and now works correctly.
CodePen Blog
Chris’ Corner: PerformanCSS
How CSS relates to web performance is a funny dance. Some aspects are entirely negligible the vast majority of time. Some aspects are incredibly impactful and crucial to consider.
For example, whenever I see research into the performance of some form of CSS syntax, the results always seem to be meh, it’s fine. It can matter, but typically only with fairly extreme DOM weight situations, and spending time optimizing selectors is almost certainly wasted time. I do like that the browser powers that be think and care about this though, like Bramus here measuring the performance of @property for CSS Custom Property performance. In the end, it doesn’t matter much, which is an answer I hope they knew before it shipped everywhere (they almost certainly did). Issues with CSS syntax tend to be about confusion or error-prone situations, not speed.
But even though the syntax of CSS isn’t particularly worrisome for performance, the weight of it generally does matter. It’s important to remember that CSS that is a regular in the is render blocking, so until it’s downloaded and parsed, the website will not be displayed. Ship, say, 1.5MB of CSS, and the site’s performance will absolutely suffer for absolutely everyone. JavaScript is a worse offender on the web when it comes to size and resources, generally, but at least it’s loading is generally deferred.
The idea of “Critical CSS” became hot for a minute, meaning ship as little render blocking CSS as you can, and defer the rest, but that idea has it’s own big tradeoffs. Related to that, it absolutely should be easier to make CSS async, so let’s all vote for that. And while I’m linking to Harry, his The Three Cs: 🤝 Concatenate, 🗜️ Compress, 🗳️ Cache is a good one for your brain.
The times when CSS performance tends to rear it’s head are in extreme DOM weight situations. Like a web page that renders all of Moby Dick, or every single Unicode character, or 10,000 product images, or a million screenshots, or whatever. That way a
Chris’ Corner: PerformanCSS
How CSS relates to web performance is a funny dance. Some aspects are entirely negligible the vast majority of time. Some aspects are incredibly impactful and crucial to consider.
For example, whenever I see research into the performance of some form of CSS syntax, the results always seem to be meh, it’s fine. It can matter, but typically only with fairly extreme DOM weight situations, and spending time optimizing selectors is almost certainly wasted time. I do like that the browser powers that be think and care about this though, like Bramus here measuring the performance of @property for CSS Custom Property performance. In the end, it doesn’t matter much, which is an answer I hope they knew before it shipped everywhere (they almost certainly did). Issues with CSS syntax tend to be about confusion or error-prone situations, not speed.
But even though the syntax of CSS isn’t particularly worrisome for performance, the weight of it generally does matter. It’s important to remember that CSS that is a regular in the is render blocking, so until it’s downloaded and parsed, the website will not be displayed. Ship, say, 1.5MB of CSS, and the site’s performance will absolutely suffer for absolutely everyone. JavaScript is a worse offender on the web when it comes to size and resources, generally, but at least it’s loading is generally deferred.
The idea of “Critical CSS” became hot for a minute, meaning ship as little render blocking CSS as you can, and defer the rest, but that idea has it’s own big tradeoffs. Related to that, it absolutely should be easier to make CSS async, so let’s all vote for that. And while I’m linking to Harry, his The Three Cs: 🤝 Concatenate, 🗜️ Compress, 🗳️ Cache is a good one for your brain.
The times when CSS performance tends to rear it’s head are in extreme DOM weight situations. Like a web page that renders all of Moby Dick, or every single Unicode character, or 10,000 product images, or a million screenshots, or whatever. That way a
box-shadow just has a crazy amount of work to do. But even then, while CSS can be the cause of pain, it can be the solution as well. The content-visibility property in CSS can inform the browser to chill out on rendering more than it needs to up front. It’s not the more intuitive feature to use, but it’s nice we have these tools when we need them.Microsoft Edge Blog
The truth about CSS selector performance
If you're a web developer, you may have already heard that some CSS selectors are faster than others. And you're probably hoping to find a list of the better selectors to use in this article. Well, not quite. But bear with me, I promise that by the