Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • CSS Tutorial
  • CSS Exercises
  • CSS Interview Questions
  • CSS Selectors
  • CSS Properties
  • CSS Functions
  • CSS Examples
  • CSS Cheat Sheet
  • CSS Templates
  • CSS Frameworks
  • Bootstrap
  • Tailwind
  • CSS Formatter
Open In App
Next Article:
How to add a button to an image using CSS ?
Next article icon

How to add image refaction using CSS ?

Last Updated : 30 May, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

This article will show how to add image reflection using CSS. To achieve this task, you can use the -webkit-box-reflect to add the reflection of any HTML element.

The box-reflect property is a CSS property that allows you to create a reflection effect for an element. It is primarily used to add a mirror-like reflection below or above an element., and box-reflect property is nonstandard property so we use -webkit-box-reflect as a prefix.

-webkit-box-reflect: This property creates an image reflected in the below, above, left, or right position.

Syntax:

-webkit-box-reflect: below | above | left | right;

Example 1: In the below code, we will make use of the above syntax to add reflection.

HTML
<!DOCTYPE html> <html>  <head>        <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />     <style>         h1 {             color:green;         }         img {             -webkit-box-reflect:right;         }     </style> </head>  <body>     <center>         <h1>GeeksforGeeks</h1>         <h3>A computer science portal for geeks</h3>              <img src= "https://media.geeksforgeeks.org/wp-content/uploads/20210915115837/gfg3-300x300.png"               alt="GFG image">     </center> </body> </html> 

Output:

 

Example 2: In the below code, we will make use of the above syntax to add reflection.

HTML
<!DOCTYPE html> <html>  <head>     <title>GeeksforGeeks</title>     <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />     <style>         h1 {             color:green;         }         img {             -webkit-box-reflect: below;         }     </style> </head>  <body>     <center>         <h1>GeeksforGeeks</h1>         <h3>A computer science portal for geeks</h3>          <img src= "https://media.geeksforgeeks.org/wp-content/uploads/20210915115837/gfg3-300x300.png"         alt="GFG image">     </center> </body>  </html> 

Output:

 

Next Article
How to add a button to an image using CSS ?
author
krishna_97
Improve
Article Tags :
  • Web Technologies
  • CSS
  • CSS-Properties
  • CSS-Questions

Similar Reads

  • How to repeat border image using CSS ?
    You can repeat border images using the border-image-repeat property in CSS. It is generally used for scaling and tiling the border-image. It is used to match the middle part of the border-image to the size of the border. Syntax:border-image-repeat: stretch|repeat|round|initial|inheritNote: The borde
    2 min read
  • How to add a mask to an image using CSS ?
    The mask-image property in CSS is used to set the mask of an image or text. CSS masking is used to form a mask layer for a particular element. You can add a mask to an image using the mask-image property in CSS. In this article, you will get to know the different property values of mask-image proper
    2 min read
  • How to add a button to an image using CSS ?
    In the article, we will explore how to add a button to an image using CSS. Adding a button to an image is often used to create an overlay effect to a button on an image that provides an interactive and engaging layout on a webpage. We can achieve this effect with the combination of various CSS Prope
    4 min read
  • How to shake an image using CSS Keyframe ?
    In this article, we will see how to shake an image using CSS Keyframe, along with knowing the different properties used to shake the image, through the code example. A shaking image or shivering effect on the image is used to make the website look more dynamic and attractive. This effect can be appl
    2 min read
  • How to Blur an Image using CSS?
    In CSS, the filter property is used to apply visual effects to images, such as blurring, grayscale, brightness adjustments, and more. One common use of the filter property is to apply a blur effect to an image, giving it a soft, out-of-focus appearance. Syntax: filter: blur(radius);radius: Defines t
    2 min read
  • How to Add Visual Effects to Images using CSS?
    CSS is most useful for adding visual effects to images, enhancing the overall user experience. By using CSS properties like filter, transform, and transition, you can create dynamic and engaging effects that respond to user interactions. In this article, we will explore examples showcasing the visua
    2 min read
  • How To Place Text on Image using HTML and CSS?
    To place text on an image using HTML and CSS, you can use different techniques to make the text look good and easy to read. Here, we will explore two approaches for placing text over an image using simple HTML and CSS. 1. Using Absolute Positioning This approach uses absolute positioning to place th
    3 min read
  • How to Flip an Image on hover using CSS?
    Flipping an image with a mirror effect on hover using CSS enhances visual interaction by applying transformations along the X or Y axis. This dynamic hover animation creates an engaging experience by flipping the image horizontally or vertically, resulting in an eye-catching, interactive effect. App
    2 min read
  • How to Darken an Image using CSS?
    To darken an image using CSS, the filter property with the brightness function and background-image property is used. By setting the brightness value below 1, you can reduce the lightness of the image, making it appear darker. 1. Using the filter PropertyThe CSS filter property allows you to apply v
    2 min read
  • How to Add Shadow to Image in CSS ?
    Adding shadow to an image can enhance its visual appeal and make it stand out on your webpage. In this article, we will explore various approaches to add shadow to an image using CSS. Table of Content Add Shadow on Image using box-shadow PropertyAdd Shadow on Image on HoverAdd Shadow on Image using
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences