Как я могу применить блок стиля CSS к нескольким различным классам? Например, у меня есть
<div class="foo">...</div> <div class="bar">...</div> ... .foo .bar ??? // This selector should apply to both classes { font-size:50%; ... }
.foo, .bar { font-size:50%; ... }
Источник: http://www.w3.org/TR/CSS2/selector.html#grouping
используйте запятую:
.foo, .bar { .... }
Возможно и обратное применение нескольких классов к одному элементу:
<html> <head> <style type="text/css"> .foo { } .bar { } </style> </head> <body> <!-- space separated list of classnames to apply multiple css classes to a single element. --> <div class="foo bar">...</div> </body> </html>