代码如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <!-- 类选择器和id选择器的区别,类选择器可以被重复调用,id选择器只能被调用一次是唯一的 --> <style> #red { color: red; } .colour { color: blue; } </style> </head> <body> <div id="red">曹操1</div> <div class="colour">曹操2</div> <div class="colour">曹操3</div> </body> </html>