W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <style> :root { --blue: #6495ed; --white: #faf0e6; } body { background-color: var(--blue); } h2 { border-bottom: 2px solid var(--blue); } .container { color: var(--blue); background-color: var(--white); padding: 15px; } button { background-color: var(--white); color: var(--blue); border: 1px solid var(--blue); padding: 5px; } </style> </head> <body> <h1>使用 var() 函数</h1> <div class="container"> <h2>Welcome to Shanghai!</h2> <p>Shanghai is one of the four direct-administered municipalities of the People's Republic of China.</p> <p>Shanghai is one of the four direct-administered municipalities of the People's Republic of China.</p> <p> <button>Yes</button> <button>No</button> </p> </div> </body> </html>