{"id":9907,"date":"2024-03-03T10:31:00","date_gmt":"2024-03-03T10:31:00","guid":{"rendered":"https:\/\/codehim.com\/?p=9907"},"modified":"2024-03-04T08:31:12","modified_gmt":"2024-03-04T03:31:12","slug":"css-image-reflection-shadow-effect","status":"publish","type":"post","link":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/","title":{"rendered":"CSS Image Reflection Shadow Effect"},"content":{"rendered":"<p>This code creates a reflection shadow effect on an image using CSS. It duplicates the image and flips it vertically to simulate a reflection. This effect adds depth and style to images displayed on a webpage.<\/p>\n<p>You can use this reflection effect for <a href=\"https:\/\/codehim.com\/gallery\/simple-css-image-gallery-with-thumbnail\/\" target=\"_blank\" rel=\"noopener\">gallery images<\/a> or image cards. It adds a stylish reflection shadow effect to images, giving them a more dynamic and appealing look.<\/p>\n<h2>How to Create Image Reflection Shadow Effect Using CSS<\/h2>\n<p>1. Start by setting up your HTML structure. Place the image within a container element.<\/p>\n<pre class=\"prettyprint linenums lang-html\">  &lt;section id=\"main\"&gt;\r\n    &lt;div class=\"image\"&gt;&lt;\/div&gt;\r\n  &lt;\/section&gt;<\/pre>\n<p>2. Now, add the necessary CSS styles to create the reflection shadow effect. Replace the <code>url()<\/code> values in the CSS code with your desired image URLs. Adjust the dimensions (width and height) of the <code>.image<\/code> class to fit your image size.<\/p>\n<pre class=\"prettyprint linenums lang-css\">body {\r\n  margin: 0px;\r\n  padding: 0px;\r\n  font-family: \"Poppins\", sans-serif;\r\n  background: #22232e !important;\r\n}\r\n* {\r\n  box-sizing: border-box;\r\n  scroll-behavior: smooth;\r\n}\r\n#main {\r\n  width: 100%;\r\n  min-height: 100vh;\r\n  background: #22232e;\r\n  display: flex;\r\n  align-items: center;\r\n  justify-content: center;\r\n}\r\n.image{\r\n  background-image: url(https:\/\/omjsblog.files.wordpress.com\/2023\/11\/1.jpg);\r\n  background-size: cover;\r\n  background-position: center;\r\n  background-repeat: no-repeat;\r\n  width: 350px;\r\n  height: 200px;\r\n  position: relative;\r\n}\r\n.image::before{\r\n  content: '';\r\n  position: absolute;\r\n  top: 102%;\r\n  left: 0;\r\n  width: 350px;\r\n  height: 200px;\r\n  background-image: url(https:\/\/omjsblog.files.wordpress.com\/2023\/11\/1.jpg);\r\n  background-size: cover;\r\n  background-position: center;\r\n  background-repeat: no-repeat;\r\n  transform: scaleY(-1);\r\n  opacity: 0.2;\r\n}\r\n.image::after{\r\n  content: '';\r\n  position: absolute;\r\n  top: 102%;\r\n  left: 0;\r\n  width: 350px;\r\n  height: 200px;\r\n  background-image: linear-gradient(transparent, #22232e 50%);\r\n}<\/pre>\n<p>The reflection shadow effect is achieved through the use of <code>::before<\/code> and <code>::after<\/code> pseudo-elements. These elements create a mirrored image below the original, simulating a reflection with a shadow.<\/p>\n<p>Feel free to experiment with the code to achieve the desired visual effect. Adjust the opacity, colors, and dimensions to match your website&#8217;s aesthetic. Test different images to see how the reflection shadow effect enhances your overall design.<\/p>\n<p>That&#8217;s all! hopefully, you have successfully created an image reflection shadow effect on your webpage. If you have any questions or suggestions, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This code creates a reflection shadow effect on an image using CSS. It duplicates the image and flips it vertically&#8230;<\/p>\n","protected":false},"author":1,"featured_media":9915,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[209],"tags":[],"class_list":["post-9907","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-animation-effects"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CSS Image Reflection Shadow Effect &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a free code snippet to create a CSS Image Reflection Shadow Effect. You can view demo and download the source code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Image Reflection Shadow Effect &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a free code snippet to create a CSS Image Reflection Shadow Effect. You can view demo and download the source code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-03T10:31:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-04T03:31:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"960\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"CSS Image Reflection Shadow Effect\",\"datePublished\":\"2024-03-03T10:31:00+00:00\",\"dateModified\":\"2024-03-04T03:31:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\"},\"wordCount\":225,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png\",\"articleSection\":[\"Animation &amp; Effects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\",\"url\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\",\"name\":\"CSS Image Reflection Shadow Effect &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png\",\"datePublished\":\"2024-03-03T10:31:00+00:00\",\"dateModified\":\"2024-03-04T03:31:12+00:00\",\"description\":\"Here is a free code snippet to create a CSS Image Reflection Shadow Effect. You can view demo and download the source code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png\",\"width\":1280,\"height\":960,\"caption\":\"CSS Image Reflection Shadow Effect\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Animation &amp; Effects\",\"item\":\"https:\/\/codehim.com\/category\/animation-effects\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CSS Image Reflection Shadow Effect\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Image Reflection Shadow Effect &#8212; CodeHim","description":"Here is a free code snippet to create a CSS Image Reflection Shadow Effect. You can view demo and download the source code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/","og_locale":"en_US","og_type":"article","og_title":"CSS Image Reflection Shadow Effect &#8212; CodeHim","og_description":"Here is a free code snippet to create a CSS Image Reflection Shadow Effect. You can view demo and download the source code.","og_url":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-03-03T10:31:00+00:00","article_modified_time":"2024-03-04T03:31:12+00:00","og_image":[{"width":1280,"height":960,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"CSS Image Reflection Shadow Effect","datePublished":"2024-03-03T10:31:00+00:00","dateModified":"2024-03-04T03:31:12+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/"},"wordCount":225,"commentCount":0,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png","articleSection":["Animation &amp; Effects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/","url":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/","name":"CSS Image Reflection Shadow Effect &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png","datePublished":"2024-03-03T10:31:00+00:00","dateModified":"2024-03-04T03:31:12+00:00","description":"Here is a free code snippet to create a CSS Image Reflection Shadow Effect. You can view demo and download the source code.","breadcrumb":{"@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2023\/11\/CSS-Image-Reflection-Shadow-Effect.png","width":1280,"height":960,"caption":"CSS Image Reflection Shadow Effect"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/animation-effects\/css-image-reflection-shadow-effect\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Animation &amp; Effects","item":"https:\/\/codehim.com\/category\/animation-effects\/"},{"@type":"ListItem","position":3,"name":"CSS Image Reflection Shadow Effect"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":958,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=9907"}],"version-history":[{"count":1,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9907\/revisions"}],"predecessor-version":[{"id":11315,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/9907\/revisions\/11315"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/9915"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=9907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=9907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=9907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}