Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Red Dot on image using CSS?

Tags:

css

image

overlay

I'm wondering if it would be possible to create a CSS style that can enable a small red dot to show up overlaying an image to indicate that it was sold?

Can you overlay a transparent image on another image using CSS?

like image 939
user2939544 Avatar asked Sep 14 '26 19:09

user2939544


1 Answers

This code generates a red dot over the container div:

#cont {
        width: 200px;
        height: 200px;
        border: 1px solid #aaa; /*To show the boundaries of the element*/
    }
    #cont:before {
        position: absolute;
        content: '';
        background-color:#FF0000;
        border-radius:50%;
        opacity:0.5;
        width: 200px;
        height: 200px;
        pointer-events: none;
    }
<div id="cont">
<img src="" alt="image here" width="200" height="200">
</div>
like image 144
bitoffdev Avatar answered Sep 17 '26 01:09

bitoffdev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!