Building Type-Safe APIs with Nuxt 3 and Prisma
Learn how to build end-to-end type-safe APIs using Nuxt 3 server routes and Prisma ORM for a seamless developer experience.
CSS has evolved dramatically. Explore nesting, :has(), container queries, cascade layers, and other modern features with excellent browser support.
Mbeah Essilfie
May 12, 2026 at 06:04 AM
Modern CSS is a powerful, declarative programming language. Many patterns that once required JavaScript or preprocessors are now native.
No more Sass just for nesting:
.card {
padding: 1rem;
border-radius: 0.5rem;
& .title {
font-size: 1.25rem;
font-weight: bold;
}
&:hover {
box-shadow: 0 4px 12px rgb(0 0 0 / 0.1);
}
@media (width >= 768px) {
padding: 2rem;
}
}
CSS can now select parents based on children:
/* Style a form group that contains an invalid input */
.form-group:has(input:invalid) {
border-color: red;
}
/* Style a card differently if it has an image */
.card:has(img) {
grid-template-rows: 200px 1fr;
}
/* Change nav style when a dropdown is open */
nav:has(.dropdown[open]) {
background: var(--nav-active-bg);
}
:has() is the most powerful CSS selector ever added. It eliminates the need for JavaScript-based "parent has class" patterns entirely.Control specificity without fighting it:
@layer base, components, utilities;
@layer base {
a { color: blue; }
}
@layer components {
.nav a { color: white; } /* Wins over base regardless of specificity */
}
@layer utilities {
.text-red { color: red !important; } /* Wins over everything */
}
Write direction-agnostic CSS:
/* ❌ Physical — breaks in RTL languages */
.element {
margin-left: 1rem;
padding-right: 2rem;
border-top: 1px solid;
}
/* ✅ Logical — works in any writing direction */
.element {
margin-inline-start: 1rem;
padding-inline-end: 2rem;
border-block-start: 1px solid;
}
Page transitions without JavaScript frameworks:
@view-transition {
navigation: auto;
}
.hero-image {
view-transition-name: hero;
}
::view-transition-old(hero) {
animation: fade-out 0.3s ease;
}
::view-transition-new(hero) {
animation: fade-in 0.3s ease;
}
Children align to parent grid tracks:
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
}
.card {
display: grid;
grid-template-rows: subgrid;
grid-row: span 3; /* Participate in 3 parent rows */
}
@supports (selector(:has(*))) {
/* Use :has() */
}
@supports not (selector(:has(*))) {
/* Fallback */
}
CSS is more powerful than ever. Check caniuse.com and start using these features — most have 90%+ browser support.
Fullstack Software Developer
Learn how to build end-to-end type-safe APIs using Nuxt 3 server routes and Prisma ORM for a seamless developer experience.
Go beyond basic utility classes and learn how to build cohesive, maintainable design systems with Tailwind CSS.
Understand the power of Vue 3's Composition API through practical, real-world composable patterns that you can use today.
