陪你做好前端设计!
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="utf-8"> <title>素材8网教程(study.sucai8.cn)</title> </head> <body> <picture> <source srcset="/wp-content/uploads/2015/06/img_smallflower.jpg" media="(max-width: 400px)"> <source srcset="/wp-content/uploads/2015/06/img_flowers.jpg"> <img src="/wp-content/uploads/2015/06/img_flowers.jpg" alt="Flowers" style="width:auto;"> </picture> <p>调整浏览器宽度和高度,背景在宽度小于 400px 时将改变。 </p> </body> </html>
运行结果