Agyan
adda
Run
Reset
Copy
CSS Tutorial › CSS Pseudo-classes › Pseudo-classes on a list
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<style> li { padding: 6px; } li:first-child { font-weight: bold; } li:last-child { color: gray; } li:nth-child(even) { background: #f0f6ff; } li:hover { background: #fff3cd; } li:not(.done) { border-left: 4px solid tomato; } </style> <ul> <li class="done">Learn HTML</li> <li>Learn CSS</li> <li>Learn JavaScript</li> <li>Build a project</li> </ul>
Result