css

Set the same value to multiple properties (CSS)


Is there a way to set multiple CSS properties to one value?

border-left, border-right: 1px solid #E2E2E2;

The way that you can do with selectors?

.wrapper, .maindiv { ... }

Solution

  • Nope. But for your example, you can do this:

    border: solid #E2E2E2;
    border-width: 0 1px;
    

    The attributes where there can be separate values for top, right, bottom, and left (eg, border-*, margin, padding) can usually be combined in a single attribute.