首页
HTML
HTML 类
试用:两个元素 - 一个类
运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <head> <style> .city { background-color: tomato; color: white; padding: 10px; } </style> </head> <body> <h2>Different Elements Can Share Same Class</h2> <p>Even if the two elements do not have the same tag name, they can both point to the same class, and get the same CSS styling:</p> <h2 class="city">Paris</h2> <p class="city">Paris is the capital of France.</p> </body> </html>