Match all elements having class name starting with a specific string [duplicate]

The following should do the trick:

div[class^='myclass'], div[class*=' myclass']{
    color: #F00;
}

Edit: Added wildcard (*) as suggested by David

Leave a Comment