代码
提交代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=`, initial-scale=1.0"> <title>Document</title> <style> .demo>.demo:only-child{ color:#fff; background: red; padding:10px; } </style> </head> <body> <body> <div class="demo"> 慕课网 <div class="demo"> 慕课网 </div> </div> </body> </body> </html>
运行结果