CSS怎么把一张图片放在底部

在css中,可以利用position属性,将图片元素设置为固定定位样式,然后通过bottom属性,设置图片元素距离底部的距离为0,就可以把图片固定在底部了。

当position属性的值为fixed时,会将元素设置为固定定位样式。

示例如下:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
  img{
    position:fixed;
    bottom:0;
  }
  </style>
</head>
<body>
  <img src="1118.02.png" alt="">
</body>
</html>

输出结果:

css怎么把一张图片放在底部

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。