Is it possible to get the difference between width & max-width?

Is it possible to get the difference between width and max-width for a CSS class? … Read more Is it possible to get the difference between width & max-width?

Is it possible to get the difference between width and max-width for a CSS class? For example, let consider the following class:

.className {
  width: 100mm;
  max-width: 100vw;
}

If the container is smaller than 100mm, let’s say it is 90mm, then the difference would be 10mm. Then based on that difference apply different styling, similar to as one would with a media query for different screen sizes.

The use case being, className is 10% (10mm of 100mm) smaller than expected and there for all sub-components in it need to be scaled down by 10% to maintain their relative size.

If not possible with straight CSS can this be done with SASS/SCSS or maybe stylus or LESS?

Source: CSS – Stack Overflow


Categories: NewsTags: , , ,

Tags: , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *