How to Create Realistic Image Reflection in CSS

How to Create Realistic Image Reflection in CSS

Here you will learn how to create Realistic Image Reflections using CSS and HTML. Here I have used an image and created a reflection of that image which can be seen at the bottom of the image. 

This CSS Image Reflection will look absolutely Realistic, that is, it will look as if the shadow of the image has fallen down.

If you want to use an image on any of your web pages and make it a little more interesting then you can use this type of CSS Realistic Image Reflection. You only need to use one line of CSS to create this reflection.

How to Create Image Reflection in CSS

Here I have tried to explain to you very well how to add Realistic Reflection to the image. First I added the image using one line of HTML. 

Then I designed the image using CSS. Then I added this Reflection at the bottom of the image using only one line CSS.

See the Pen Untitled by Shantanu Jana (@shantanu-jana) on CodePen.


If you want, you can download all the source code with the help of the button below the article. If you want to see the preview then use the demo section above. Earlier I shared many types of image sliders and image gallery creation tutorials.


There are only two steps to follow. I first added the image in HTML. In the second step, I designed the image and added Reflection.

HTML Code:

I added the image using the HTML code below. Single line HTML is used here. You can change this image to your liking.

<img src="https://images5.alphacoders.com/343/thumb-1920-343645.jpg" alt="">

CSS Code:

I designed the image using the following codes and added reflections.

body{
  background-color: #000000;
  padding: 0;
  margin: 0;
}

img{
  width: 500px;
  position: absolute;
  transform: translate(-50%,-50%);
  top: 30%;
  left: 50%;
  -webkit-box-reflect: below 4px linear-gradient(transparent 20%, rgba(0,0,0,0.35));
}

Hopefully, you can create Realistic Image Reflection css using the codes above. Only the last line has added Reflection to this Image.






Comments

Popular posts from this blog

Simple Day Night Toggle Button Using HTML and CSS

Splash Image Mask Using HTML and CSS (Free Code)

Simple RGB Color Generator Using JavaScript & CSS