Sobes.tech
Intern

Räägi mulle viimase huvitava fakti kohta, mida sa CSS kohta õppis.

sobes.tech AI

Vastus AI-lt

In CSS, a very interesting feature has appeared — Container Queries. They allow applying styles not only depending on the size of the browser window (like media queries), but also depending on the size of the parent container. This is especially useful for creating responsive components that can change their appearance depending on where they are used, and not just on the screen width.

Example of usage:

.card {
  container-type: inline-size;
}

@container (min-width: 400px) {
  .card {
    background-color: lightblue;
  }
}

Here, .card becomes a container, and styles inside it change if the container's width exceeds 400px. This opens new possibilities for modular and responsive design.