Achieving a vertical cube rotation when hovering by utilizing matrix3d properties

I'm looking to achieve a vertical flip effect similar to this example: , but for horizontal items.

However, the following code snippet did not produce the desired effect:

.navbar li {
      float: left;
      margin-left: 20px;
      list-style-type: none;
      position: relative;
    }

    navbar a.link span.active,
    .navbar a.link span.hover {    
      display: table;
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      transform-origin: 0% 50% 0px;
      -webkit-transform-origin: 0% 50% 0px;
      transition: .2s;
      -webkit-transition: .2s;  
      border-bottom: 1px solid #555;    
    }
    .navbar a.link span.active {
      transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
      -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);

      left: 0;
      background-color: #444;
    }
    .navbar a.link:hover span.active {
        background-color: #999;
        transform: matrix3d(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, -50, 0, 0, 1);
        -webkit-transform: matrix3d(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, -50, 0, 0, 1);
    }

    .navbar a.link span.active .vertical { 
      color: #aaa;
    }

    .navbar a.link span.hover {
      transform: matrix3d(0, 0, -1, 0.00166, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1);
      -webkit-transform: matrix3d(0, 0, -1, 0.00166, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1);
      left: 91%;
      background-color: #ccc;
    }

    .navbar a.link:hover span.hover {
        transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.00166, -50, 0, 0, 1);
        -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.00166, -50, 0, 0, 1);
    

You can view and test the code on jsfiddle here: http://jsfiddle.net/Ff3qW/

Answer №1

Utilizing the transfrom scale property allows for vertical image rotation.
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        #container {
            position: absolute;
            width: 50%;
            height: 20%;              
        }
        #info1:hover {
            -moz-transform: scaleY(-1);
            -webkit-transform: scaleY(-1);
            -o-transform: scaleY(-1);
            transform: scaleY(-1);
            -ms-filter: flipv; /*IE*/
            filter: flipv; /*IE*/
            top: 1px;
            position: relative;
        }
        #info1{
            transition: 1s;
        }
    </style>
</head>
<body>
    <div id="container">
        <img id="info1" src="info.png" alt="icons" />

    </div>
</body>
</html>

Answer №2

Exploring the art of vertical flip using matrix3d, I crafted a fiddle as an illustration. Additionally, delving into the intricacies of matrix3d has been quite enlightening. Feel free to experiment with the parameters in this demonstration: http://example.com/unique-link

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A guide to adjusting the top margin of centered elements in React

I've got elements inside the App_body, and I've centered them both horizontally and vertically using Flex. <div className="App-body"> < Element1 className="element1"/> < Element2 /> < Element3 /> </div> .App-body ...

Is the div not occupying the full width and height due to the presence of invisible scrollbars?

My attempts to make the selected child, its parent, and html/body all have a height/width of 100% with padding right/bottom 0 seem unsuccessful. These mysterious bottom and right bars pop up once a month and it's so irritating. They are identical in ...

Turn off the background color box with a single click

Whenever I click on a header menu item, the background changes along with it. Is there a way to prevent this from happening? https://i.stack.imgur.com/p6bJ9.png Take a look here ...

Angular dropdown option not displaying tick mark

I'm attempting to add a tick mark before a specific default item in the option dropdown of my Angular application. The item in question is named Steven, as shown in this example. How can I make this happen? For some reason, it doesn't seem to be ...

Ways to divide background color in half using CSS

Looking for some help with CSS - I want to split an HTML page into two sections, with a background and text/login form on top. Can anyone provide sample CSS and HTML code? This is what I've tried so far in CSS: .logindiv { height: 200px; width: ...

Mastering the alignment of elements in HTML, CSS, and Bootstrap

Currently, I am utilizing Thymeleaf, Bootstrap, and CSS for the front-end view of my project. I am encountering an issue where I am unable to align the button and the level as displayed in the provided image: https://i.sstatic.net/8RoPi.png Update: Below ...

SVG - Various images displaying unique characteristics

Trying to create a visual graphic with two images, one representing an empty state and the other a filled state. The challenge is determining how to adjust the width of only one image while keeping them the same height using a clip path. For example, I w ...

Element sticking on scroll down and sticking on scroll up movements

I am currently working on a sticky sidebar that catches and stays fixed at a certain scroll point using JavaScript. However, I am facing an issue where I need the sidebar to catch when scrolling back up and not go further than its initial starting point. ...

Unable to achieve horizontal scrolling when using Locomotive Scroll with Vue.js

I am dealing with a challenge involving two pages - Home (vertical scrolling) and About (horizontal scrolling). I want to implement smooth scrolling, but I am encountering some issues. When navigating from the Home page to the About page, the horizontal s ...

Embedding SVG styling directly into the HTML document

When importing svg images with color into Mapbox Studio, they appear as black and white. The troubleshooting website mentions: If your SVG appears black after adding to Mapbox Studio, it may be due to using style properties in tags instead of inline sty ...

What's the best way to ensure that the button stays on the right side of the Bootstrap 4 card header, no matter the device or

Here is my code for a refresh button in the header of a Bootstrap 4 card: <div class="animated fadeIn"> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-header"> ...

The ineffectiveness of setting width to 0

When I set @media screen and (max-width: 700px), aside {width: 0}, it doesn't disappear. Even after resizing the window, it remains as null space with width: 52px. What could be causing this issue and how can I resolve it? * { margin:0; padding ...

currently experiencing layout discrepancies with Flexbox

Experimenting with flexbox has been challenging, but I am close to achieving my desired layout: Place a label in the top left of the first container Position a label in the top right of the first container Align a label in the bottom middle of the first ...

JavaScript failing to load following PHP header() redirect

I've set up a page that allows users to sign in by filling out a basic form, which then sends the data to a separate PHP script for validation. After the validation process is complete, the PHP script uses the header() function to redirect the user to ...

Troubleshooting a Button Problem with CSS in Twitter Bootstrap

Here is the original source (with problem) However, when attempting to replicate the issue in jsfiddle, I am getting the correct result What could be causing this discrepancy? How can I resolve this issue? ...

Tips on incorporating a style-tag into the body of an Angular 5 application

We offer a service that collects a vast amount of data to be displayed in an angular 5 application. The model used for displaying this data is constantly evolving and shared across multiple applications, so I need to import it dynamically. My approach inv ...

The media query fails to start in the browser's mobile display

Instead of just adjusting the browser window size, I utilized Chrome's developer tools to make adjustments. I double-checked that the appropriate meta tags were included in the code: <meta name="viewport" content="width=device-width, initial-scal ...

What is the best way to remove the bullets adjacent to my Twitter feed?

Greetings! I am currently working on a homepage with a Twitter feed, but I am struggling to remove the bullets. Despite my efforts to find the correct CSS code (inputting "list-style-type: none;"), I have been unsuccessful. I've spent quite some time ...

The scrollbar in the InfoWindow of an Angular GoogleMaps marker is not being hidden

Is it possible to customize the popup info window that appears when a marker is clicked, without having a scrollbar on the right if the content overflows? Visit this link for an image (image didn't load when using the image template) I've attem ...

Arrange all the items in the list to be aligned on a single

Here is the code and styles I have in my project: I want to align the texts and span style. My default code looks like this: body { direction: rtl; } div { position: absolute; top: 30px; right: -100px; height: 300px; overflow-y: scroll; ba ...