June 1, 201313 yr Does anyone know how to affect multiple classes from within CSS? For example I have a series of bars I'd to apply some universal CSS to. For example .bar-1 .bar-2 .bar-3 and I want to apply "height: 10px;" to each without having to repeat it for each .bar-* class. I've found similar uses within CSS elsewhere like: [class=*-bar-*] Edited June 1, 201313 yr by JordanC
June 1, 201313 yr Are they in a parent container? If so and if there aren't any other divs (that you don't want to target) in the parent container, you can use: .parent div{ height:10px; }
June 1, 201313 yr Why not .bar1, .bar2, .bar3{height:10px} or add an extra class <ul> <li class="bar1 barht">Your stuff</li> <li class="bar2 barht">Your stuff</li> <li class="bar3 barht">Your stuff</li> <li class="bar4 barht">Your stuff</li> <ul> .barht{height:10px}
Create an account or sign in to comment