1

there are two class that start with post-meta- like this.

<div class="post-meta-top"></div>
<div class="main-text"></div>
<div class="post-meta-bottom"></div>

Normally I must write like .post-meta-top, .post-meta-bottom, but if possible I want to write like .post-meta-*.

I know it's impossible with scss right now. My question is "Is there similar function in scss or in other css extended language?"

ironsand
  • 14,329
  • 17
  • 83
  • 176

2 Answers2

2

You can do this with the attribute selector

div[class^='post-meta-']
{
  ..
}

FIDDLE

From the w3c spec:

[att^=val]

Represents an element with the att attribute whose value begins with the prefix "val". If "val" is the empty string then the selector does not represent anything.

Community
  • 1
  • 1
Danield
  • 121,619
  • 37
  • 226
  • 255
-1

You can try jQuery to match multiple class,

<script>
    $( "div[class^='post-meta']" )
</script>
Kishori
  • 1,065
  • 6
  • 12