Sometimes we need to darken an image. One of the particular cases is for light and dark modes. An image is expected to be dark on dark mode.
We can do this using the CSS
filter property and the
filter: This is a CSS property that will allow us to add the darkness filter.
brightness: This is the brightness function that accepts a percentage value. The default is
%100percent. A lower percentage leads to a darker image. And higher percentage value leads to a brighter image.
value: This is the percentage specified for the brightness function.
.darkclass and the other has no class.
srcthe attribute we link to the image we want to use.
50%of the body tag and should have automatic margins that will make the images centered.
.darkclass by specifying the filter property to be a
brightness()function. The value we specify is
View all Courses