Home > Web Front-end > CSS Tutorial > xciting Updates from the Chrome Beta for Web Developers

xciting Updates from the Chrome Beta for Web Developers

Mary-Kate Olsen
Release: 2025-01-27 14:06:09
Original
668 people have browsed it

xciting Updates from the Chrome  Beta for Web Developers

Chrome 133 Beta is packed with exciting updates for web developers! This post highlights key improvements you should know about. While you don't need to master everything immediately, familiarity with these features will empower you to leverage them when needed. Checking release notes regularly is a great habit to cultivate.

  1. The :open Pseudo-Class:

This new pseudo-class simplifies styling of elements in their open state. It works with <dialog>, <details>, and elements with visible pickers (like <select>).

Code Example:

<code class="language-css">/* Style open dialogs/details */
:open {
  border: 2px solid blue;
}

/* Style selects with active picker */
select:open {
  background: #f0f0f0;
}</code>
Copy after login
  1. scroll-state: stuck and scroll-state: snapped:

These properties enable styling based on scroll snapping behavior. The stuck state applies styles when an element is fixed in place, while snapped applies styles when an element snaps to a designated position. Ideal for scroll-driven animations.

Code Example:

<code class="language-css">/* Define a sticky element with scroll-state container */
.sticky-element {
  container-type: scroll-state;
  position: sticky;
  top: 0;
}

/* Apply styles when the element is stuck to the top */
@container scroll-state(stuck: top) {
  .sticky-element {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }
}</code>
Copy after login
  1. text-box-trim:

This long-awaited feature allows precise control over extra space around text within text boxes. x-height and cap-height provide options for trimming.

Code Example:

<code class="language-css">/* Trim text at x-height */
.text-trim {
  text-box-trim: x-height;
}

/* Trim at cap height */
.heading {
  text-box-trim: cap-height;
}</code>
Copy after login
  1. Popover Attribute Values:

The popover attribute now offers auto, manual, and hint values, enhancing tooltip and similar UI element control.

  1. DOM State Preserving Mode:

A new node.prototype.moveBefore primitive allows moving DOM elements without resetting their internal state.

  1. Enhanced attr() Function:

The attr() function now supports fallback values, including custom properties.

Code Example:

<code class="language-css">/* Use data attribute with fallback */
div {
  color: attr(data-color, color, red);
}</code>
Copy after login

This Chrome 133 Beta release offers significant improvements for web developers. Stay updated with the official resources for more in-depth information. Consider sharing this information with your network! Connect with me on LinkedIn, Medium, and Bluesky for further discussions.

The above is the detailed content of xciting Updates from the Chrome Beta for Web Developers. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template