Home  >  Article  >  Web Front-end  >  How to put an image at the bottom with css

How to put an image at the bottom with css

WBOY
WBOYOriginal
2021-12-10 15:35:4611444browse

Method: 1. Use the position attribute to set the picture element to a fixed positioning style. The syntax is "picture element {position:fixed;}"; 2. Use the bottom attribute to fix the picture element with a fixed positioning style. The bottom is enough, and the syntax is "picture element {bottom:0;}".

How to put an image at the bottom with css

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

How to put a picture at the bottom in css

In css, you can use the position attribute to set the picture element to a fixed positioning style , and then use the bottom attribute to set the distance between the picture element and the bottom to 0, so that the picture can be fixed at the bottom.

When the value of the position attribute is fixed, the element will be set to a fixed positioning style.

The example is as follows:

<!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>

Output result:

How to put an image at the bottom with css

##(Learning video sharing:

css video tutorial

The above is the detailed content of How to put an image at the bottom with css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does top mean in cssNext article:What does top mean in css