如何使用 CSS 缩小图片使其响应式显示

cssweb developmentfront end technology更新于 2024/7/24 18:52:17

要使图片响应式显示,您可以尝试运行以下代码:

示例

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

相关文章


有用资源