Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> ul li { list-style-type: square; } li:only-child { color: blue; list-style-type: disc; } </style> </head> <body> <h2>:only-child selector example</h2> <ol> <li> One element <ul> <li>This list has just one element.</li> </ul> </li> <li> Two elements <ul> <li>This list has two elements.</li> <li>This list has two elements.</li> </ul> </li> <li> Three elements <ul> <li>This list has three elements.</li> <li>This list has three elements.</li> <li>This list has three elements.</li> </ul> </li> </ol> </body> </html>