In CSS, there is no property background-opacity, but you can fake it by inserting a pseudo-element with regular opacity. Using that trick you can create a watermark effect with few lines of CSS.
Khaled Garbaya: [0:00] Here, I have a div that contains an image. I would like to apply some watermarks on the bottom right in here, using my logo. To do that, let's first set the div position to relative.
[0:22] Then we go to the div after selector. We set the content to be empty. We can give it a width of 80 pixel, and a height of 80 pixel. That's the height of my logo. Now, we can apply a background.
[0:48] This will be the URL image of my watermark logo. We set it to no-repeat. After that, we need to set the position to absolute.
[1:03] You can see the logo is over here. Now, we set the bottom to zero, and the right to zero. Now, we want to set some transparency for the logo. For that, we can do opacity, .3. That's how you do a watermark effect using CSS.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!