Edit in JSFiddle
Result
HTML
CSS
<h2>これにはヒットしない<h2> <h2 title="タイトル内容">ヒットする<h2> <h2 title="">ヒットする<h2>
h2[title] { color : red; }