{"id":109,"date":"2026-10-02T10:15:00","date_gmt":"2026-10-02T05:15:00","guid":{"rendered":"https:\/\/example.com\/?p=109"},"modified":"2026-10-02T10:15:00","modified_gmt":"2026-10-02T05:15:00","slug":"modern-css-features-2026","status":"publish","type":"post","link":"https:\/\/www.nexooraclub.com\/?p=109","title":{"rendered":"Modern CSS in 2026: 8 Features You Should Be Using Today"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">CSS has changed more in the last few years than in the decade before. Features that used to need JavaScript, preprocessors or clever hacks are now built into every modern browser.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are eight you can use in production today.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Container queries<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Media queries respond to the <em>screen<\/em> size. <strong>Container queries<\/strong> respond to the size of the <em>parent element<\/em> \u2014 perfect for reusable components that might sit in a wide main column or a narrow sidebar.<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>.card-wrapper {\n  container-type: inline-size;\n}\n\n@container (min-width: 480px) {\n  .card {\n    display: grid;\n    grid-template-columns: 200px 1fr;\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The same card now lays itself out correctly wherever you drop it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. The :has() selector<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">For twenty years developers asked for a &#8220;parent selector&#8221;. Now we have one \u2014 and it&#8217;s even more powerful.<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>\/* Style a card differently if it contains an image *\/\n.card:has(img) { padding: 0; }\n\n\/* Highlight a form field's label when the input is invalid *\/\nlabel:has(+ input:invalid) { color: crimson; }\n\n\/* Dim the page when a dialog is open *\/\nbody:has(dialog[open]) { overflow: hidden; }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. Native nesting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You no longer need Sass just to nest selectors:<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>.nav {\n  display: flex;\n  gap: 1rem;\n\n  &amp; a {\n    color: inherit;\n\n    &amp;:hover { color: var(--accent); }\n  }\n\n  @media (width &lt; 640px) {\n    flex-direction: column;\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"tp-callout wp-block-paragraph\">Notice the <code>width &lt; 640px<\/code> syntax? That&#8217;s the new <strong>media query range syntax<\/strong> \u2014 much easier to read than <code>max-width: 639px<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. color-mix()<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create tints, shades and transparent versions of a brand colour without hard-coding a dozen hex values:<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>:root { --brand: #6366f1; }\n\n.badge {\n  background: color-mix(in srgb, var(--brand) 12%, transparent);\n  border: 1px solid color-mix(in srgb, var(--brand) 30%, white);\n  color: var(--brand);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change <code>--brand<\/code> once and every derived colour updates automatically. (This very blog&#8217;s theme uses this trick for its category badges.)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Cascade layers (@layer)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Specificity wars are over. Layers let you decide which group of styles wins, regardless of selector strength:<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>@layer reset, base, components, utilities;\n\n@layer components {\n  .button { padding: 12px 20px; }\n}\n\n@layer utilities {\n  .p-0 { padding: 0; } \/* always wins over components *\/\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">6. View transitions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Smooth, app-like animations between page states \u2014 or even between full page loads \u2014 with almost no code:<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>@view-transition { navigation: auto; }\n\n.post-title { view-transition-name: post-title; }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add that to a multi-page site and navigating between pages cross-fades automatically, with matching elements morphing into place.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7. Subgrid<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nested grids can finally align to their parent&#8217;s tracks. Card titles, text and buttons line up perfectly across a row, even when content lengths differ:<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>.cards { display: grid; grid-template-columns: repeat(3, 1fr); }\n.card {\n  display: grid;\n  grid-row: span 3;\n  grid-template-rows: subgrid;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">8. text-wrap: balance and pretty<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two tiny properties that make typography look professionally set:<\/p>\n\n\n\n<pre class=\"wp-block-code language-css\"><code>h1, h2, h3 { text-wrap: balance; } \/* evenly balanced headline lines *\/\np { text-wrap: pretty; }            \/* avoids a lonely last word *\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Browser support at a glance<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Chrome \/ Edge<\/th><th>Firefox<\/th><th>Safari<\/th><\/tr><\/thead><tbody><tr><td>Container queries<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><tr><td>:has()<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><tr><td>Native nesting<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><tr><td>color-mix()<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><tr><td>Cascade layers<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><tr><td>View transitions (same-document)<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><td>&#x2705;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Always check <a href=\"https:\/\/caniuse.com\">caniuse.com<\/a> for the latest details on newer sub-features before relying on them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final thoughts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Modern CSS lets you write less code, ship less JavaScript and build components that adapt to any layout. Pick one feature from this list \u2014 <code>:has()<\/code> is a great start \u2014 and refactor a single component this week. You won&#8217;t want to go back.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Container queries, :has(), native nesting, color-mix() and view transitions are now supported everywhere. Here&#8217;s how they replace hacks you&#8217;ve been writing for years.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[13,19,35],"class_list":["post-109","post","type-post","status-publish","format-standard","hentry","category-web-development","tag-css","tag-frontend","tag-web-design"],"_links":{"self":[{"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=\/wp\/v2\/posts\/109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=109"}],"version-history":[{"count":0,"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nexooraclub.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}