File_Submit File_Submit - 1 year ago 98
CSS Question

CSS: one property for multiple classes

I have the following:

.category-2 .content aside {margin-top: 4px;}
.category-3 .content aside {margin-top: 4px;}
.category-4 .content aside {margin-top: 4px;}

How can use one margin-top for all the three categories?

Answer Source

Use the ',' char to share your property to multiple selectors:

.category-2 .content aside,
.category-3 .content aside,
.category-4 .content aside
   margin-top: 4px;

This way of formatting css is called comma separated selector, as @Aaron suggests.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download