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 create a drop shadow effect using CSS ?
Next article icon

How to Create Paradoxical Effect using CSS ?

Last Updated : 14 Feb, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

Paradoxical effect is the effect where the divs or the elements are placed in circular form top of each other. This type of effect is useful when you want to design a circular button that opens up when you hover and each button assigns some task and place like the top of each other.
In the below example, we will use z-index. Placing like this is needed to be expert on position property and top, left, right, and bottom property. Then you can easily design paradoxical effects.

Below examples illustrate the approach to create paradoxical effect:

Example 1:




<!DOCTYPE html>
<html>
  
<head>
    <title>Paradoxical effect by HTML and CSS</title>
      
    <style>
        h1 {
            color: green;
        }
          
        div {
            height: 200px;
            width: 200px;
            line-height: 200px;
            color: white;
            font-size: 24px;
            font-weight: bold;
        }
          
        .box1 {
            position: relative;
            background-color: green;
            z-index: 3;
        }
          
        .box2 {
            position: relative;
            left: 140px;
            top: -60px;
            background-color: blue;
            z-index: 3;
        }
          
        .box2:before {
            content: '';
            position: absolute;
            bottom: -2px;
            left: -2px;
            width: 62px;
            height: 60px;
            z-index: 14;
            background-color: red;
        }
          
        .box3 {
            position: relative;
            left: 0;
            top: -120px;
            background-color: red;
            z-index: 1;
        }
          
        .box4 {
            position: relative;
            left: -140px;
            top: -465px;
            background-color: yellow;
            z-index: 2;
        }
    </style>    
</head>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <h3>A Computer Science Portal for Geeks</h3>
        <div class="box1">Box1</div>
        <div class="box2">Box2</div>
        <div class="box3">Box3</div>
        <div class="box4">Box4</div>
    </center>
</body>
  
</html>
 
 

Output:

Example 2:




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Paradoxical effect
        by HTML and CSS
    </title>
  
    <style>
        h1 {
            color: green;
        }
          
        div {
            height: 100px;
            width: 100px;
            border: solid 1px;
            border-radius: 50%;
        }
          
        .Circle1 {
            position: relative;
            left: 0px;
            background-color: green;
            z-index: 1;
        }
          
        .Circle2 {
            position: relative;
            left: 70px;
            top: -70px;
            background-color: purple;
            z-index: 2;
        }
          
        .Circle3 {
            position: relative;
            left: 40px;
            top: -90px;
            background-color: brown;
            z-index: 3;
        }
          
        .Circle3:before {
            content: '';
            position: absolute;
            bottom: 15px;
            left: -5px;
            width: 22px;
            height: 62.9px;
            border-right: 1px solid black;
            z-index: 20;
            background-color: pink;
            border-radius: 50%;
  
        }
        .Circle4 {
            position: relative;
            left: -70px;
            top: -270px;
            background-color: yellow;
            z-index: -1;
        }
          
        .Circle5 {
            position: relative;
            left: -40px;
            top: -290px;
            background-color: pink;
            z-index: -2;
        }
        div {
            text-align: center;
        }
    </style>
</head>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <h3>
            A Computer Science Portal for Geeks
        </h3>
        <div class="Circle1"></div>
        <div class="Circle2"></div>
        <div class="Circle3"></div>
        <div class="Circle4"></div>
        <div class="Circle5"></div>
    </center>
</body>
  
</html>
 
 

Output:



Next Article
How to create a drop shadow effect using CSS ?

S

skyridetim
Improve
Article Tags :
  • CSS
  • HTML
  • Web Technologies
  • CSS-Misc
  • HTML-Misc

Similar Reads

  • How to create a marquee effect using CSS ?
    In this article, we will be creating the marquee effect by using HTML and CSS. This effect can be created by using the <marquee> tag in HTML, but we will not use this tag as it is not widely used nowadays. We will create and design a marquee effect by using the CSS classes and styling properti
    2 min read
  • How to create icon hover effect using CSS ?
    To style an icon's color, size, and shadow using CSS, use the color property to set the icon's color, font size to adjust its size, and text-shadow or box-shadow for adding shadow effects, creating a visually appealing and dynamic look. Using: hover Pseudo-ClassUsing the: hover pseudo-class, you can
    2 min read
  • How to create a drop shadow effect using CSS ?
    In this article, we are going to learn how to create a drop shadow effect using CSS. drop-shadow() is an inbuilt function used to create a blurred shadow in a given offset and color. A drop shadow effect adds depth and visual interest to elements on a web page by creating a shadow behind them. This
    3 min read
  • How To Create Carved Text Effect using CSS?
    The carved text effect is also known as the embossed effect as it looks like the text has been embossed on a background. It is also known as Neumorphism in CSS. This effect is used when we want to give our website a clean and refreshing look. The embedded text can be of the same color as the backgro
    2 min read
  • How to Create a GrayScale Effect using CSS ?
    Creating a grayscale effect using CSS involves applying the filter: grayscale() property to an element, typically images. This property converts the colors of the image to shades of gray, producing a black-and-white effect, which can enhance design aesthetics and user interaction. Approach: Using fi
    2 min read
  • How to Add Onclick Effect using CSS ?
    In this article, we will see how to add onclick effect using CSS. To add the onclick effect using CSS, we can use :active pseudo selector. When an element is clicked, the onclick JavaScript event is launched. JavaScript is required to add an event listener to the HTML element and then run some code
    1 min read
  • How to create a smooth scrolling effect using CSS ?
    Smooth scrolling is employed on web pages to enhance the user experience by providing a visually appealing and seamless transition between different sections of the page. It improves readability and enhances navigation. Using the CSS property scroll-behaviour we can achieve the smooth scrolling effe
    2 min read
  • How to Create Skeleton Screen Loading Effect using CSS?
    The skeleton screens are used to indicate that the content is loading. They are also called splash screens. This is a part of the modern design trend. The skeleton screens are better than the loading spinners in some cases. It is used by many big companies like Facebook, Google, etc. HTML Code: In t
    4 min read
  • How to Create Embossed Text Effect using CSS ?
    The embossed text effect creates a 3D illusion, making text appear raised or pressed into the page. Using CSS, this effect is achieved by applying contrasting text-shadow values that simulate light and shadow, giving the text a visually elevated or indented appearance. Approach:Basic HTML Structure:
    2 min read
  • How to Create Parallax Effect in Tailwind CSS ?
    A parallax website includes fixed images in the background that are kept in place and the user can scroll down the page to see different parts of the image. If you use the parallax effect on our page then it helps the user to interact with the page. Creating Parallax Effect in Tailwind CSS At first
    3 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