"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Position an Icon Over an Image or Video and Trigger a Download on Click?

How to Position an Icon Over an Image or Video and Trigger a Download on Click?

Published on 2024-11-07
Browse:725

How to Position an Icon Over an Image or Video and Trigger a Download on Click?

Positioning an Icon Over an Image or Video

Problem:
You need to position an icon over an image or video, aligning it to the bottom left corner. When clicked, the icon should trigger a download prompt for the image.

Solution:
To achieve the desired positioning, you need to create a relative container around the image. Then, set the icon's position to absolute. Here's a code example:

.container {
  position: relative;
}

.container img {
  display: block;
}

.container .fa-download {
  position: absolute;
  bottom: 0;
  left: 0;
}
How to Position an Icon Over an Image or Video and Trigger a Download on Click?

Bootstrap 3 Font-Awesome:
Yes, the same method works for Bootstrap 3 Font-Awesome. Replace the Font Awesome version in the code above with the following:

How to Position an Icon Over an Image or Video and Trigger a Download on Click?
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3