W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> div { width: 100%; height: 400px; background-image: url('/i/photo/flower-5.jpg'); background-repeat: no-repeat; background-size: contain; border: 1px solid red; } </style> </head> <body> <p>请调整浏览器窗口大小来查看效果。</p> <div></div> </body> </html>