代码示例:(标识:responsive_image_2)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
img {
  max-width: 100%;
  height: auto;
}
</style>
</head>
<body>

<img src="/static/demo/images/shanghai.jpg" width="460" height="306">
<p>请调整浏览器窗口的大小,来查看宽度小于 460 像素时图像如何缩放。</p>

</body>
</html>
运行结果: