Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
cssセレクターのみを使用して最初の空でない子要素を見つける方法は? 私を助けてくれる人はいますか?どうもありがとう!!!
以下のように:
<ul><li></li>...<li><span>o haha</span></li>...<li></li></ul>
CSSセレクターで最初の空でないli要素を取得するにはどうすればよいですか
これを機能させるには、2つのセレクターが必要です。
li:not(:empty) { /* First non-empty <li> styles */ } li, li:not(:empty) ~ li { /* All other <li> styles */ }
例:
http://jsfiddle.net/tr958/2/