How to set two (or more) css parameters at once?

Asked

Viewed 46 times

1

I wonder if it is possible, in a scenario where the two values were equal. I would do this to advance the writing.

For example, pass HEIGHT and WIDTH together: height, width: 50px;

I tried to do this, but it didn’t work... Someone?

  • 1

    Everything that can be done with these properties is documented here: http://www.w3schools.com/css/css_dimension.asp

1 answer

3


The most you can do is store the value in a variable:

div {
  --size: 30px;
  width: var(--size);
  height: var(--size);
  background: #333;
}
<div></div>

More about variables in CSS.

Support.

More features will require a pre-processor.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.