/* class属性の値の中に
   "alert"という単語が含まれているすべての要素を選択します。 */
[class~="alert"] {
    background-color: darkblue;
    color: white;
}
<p class="alert caution">alert caution</p>
<p class="warning alert">warning alert</p>
<p class="alert-caution">alert-caution</p> <!-- 空白で区切られた単語ではないので注意 -->
<p class="alertcaution">alertcaution</p> <!-- 空白で区切られた単語ではないので注意 -->
<p class="warning-alert">warning-alert</p> <!-- 空白で区切られた単語ではないので注意 -->
<p class="warningalert">warningalert</p> <!-- 空白で区切られた単語ではないので注意 -->
<p class="alert">alert</p> <!-- 全体が一致するため選択されます -->
実際の適用例
[class~="alert"] {
    background-color: darkblue;
    color: white;
}

/* 次のように記述しても同じです。 */
[class~='alert'] {
    background-color: darkblue;
    color: white;
}
/* class属性の値に
   "alert"という文字列が含まれているすべての要素を選択します。 */
[class*="alert"] {
    background-color: darkblue;
    color: white;
}
<p class="alert caution">alert caution</p>
<p class="warning alert">warning alert</p>
<p class="alert-caution">alert-caution</p>
<p class="alertcaution">alertcaution</p>
<p class="warning-alert">warning-alert</p>
実際の適用例