如何使用CSS缩小图像以使其响应

要使图像具有响应式,您可以尝试运行以下代码:

示例

实时演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         img {
            max-width: 100%;
            height: auto;
         }
      </style>
   </head>
   <body>
      <img src = https://www.tutorialspoint.com/videotutorials/images/coding_ground_home.jpg alt = Online Compiler width = 300 height = 300>
   </body>
</html>

以上就是如何使用CSS缩小图像以使其响应的详细内容,更多请关注双恒网络其它相关文章!

简简单单挺好的

联系我们 订单查询