Tips for creating a 3D illusion by coding a div or object to rotate around another object or div

I have reached a technical and intellectual roadblock. The issue at hand is this: I need the text to encircle an image and create the illusion that it is moving in front of or behind the image, while keeping the image static.

Currently, 1) the rotating text is nested inside a div called "loader." 2) Each letter has its own div for proper rotation and degrees adjustment. And 3) the animation rotates all the letters to give the appearance of encircling. However, I want the last div within the overall structure to remain stationary.

Here is the code:

body {
  background-color: #333;
}

/* Remaining CSS code */

<div class="preloader">
  <div class="preloader__ring">
    <div class="preloader__sector"></div>
    <!-- More sector divs -->
  </div>
  <div class="phone_static">
    <img src="https://github.com/Jitlclarke/ux_portfolio/blob/main/images/small_version_mockup.png?raw=true" alt="" height=560 width=300>
  </div>
</div>

This is what it currently looks like after following some unsuccessful attempts:

  1. I tried putting the text inside a div and using position:fixed on the class, as well as creating an animation with deg going in the opposite direction for an extended duration, but without success.

So far, I have only managed to rotate the "phone_static" div in the opposite direction but haven't been able to stop it.

Answer №1

To ensure the phone is positioned correctly outside of the animated container, you must include transform-style: preserve-3d; in the body element. Once this is done, you can easily adjust the image position.

Here is an example that may need some tweaking to achieve perfection:

body {
  background-color: #333;
}

/* Additional CSS styles */

....
....

<div class="preloader">
... (HTML code snippet)
</div>
  <div class="phone_static">
    <img src="https://link-to-your-image.png" alt="" height=560 width=300>
  </div>

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

Reset all divs to their default state except for the one that is currently active using jQuery

Here's the plan for my script: Once a user clicks on a "learn more" button, it will reveal the relevant information in the corresponding box. I'm aiming to implement a feature where if you click on another "learn more" button while one box is a ...

Navigating Parent Menus While Submenus are Expanded in React Using Material-UI

My React application includes a dynamic menu component created with Material-UI (@mui) that supports nested menus and submenus. I'm aiming to achieve a specific behavior where users can access other menus (such as parent menus) while keeping a submenu ...

Ways to incorporate a scroll feature and display an iframe using JQuery

Is there a way to animate the appearance of hidden iframes one by one as the user scrolls down the website using jQuery? I have come across some solutions, but they all seem to make them appear all at once. I'm looking for a way to make the iframes s ...

Behold the magic of a three-column layout with sticky scroll behavior and an absolute

I am struggling with a layout that involves 3 columns, each with its own independent scroll. The first column contains an absolute element that should overflow on the x-axis, but I am having trouble getting the overflow-x:visible property to work when comb ...

What's the Best Way to Add a Border to My Two-Column Form?

I'm currently working on a reservation form for my website with a 2-column layout. In one column, I have tables, and I've been trying to add a divider between the columns but haven't found a solution yet. Despite researching ways to add a d ...

IE9 does not properly display SVGs used as background images

Utilizing SVG files as backgrounds for my HTML elements has been successful in most major browsers. However, an issue arises when trying to ensure compatibility with Internet Explorer 9. The problem lies within IE9's rendering of the SVG backgrounds, ...

Unable to eliminate the unwanted space at the top of the division

I am encountering an issue where I have a div containing a label, but there seems to be some unwanted space above the div that I can't seem to remove. It's puzzling me as to why this space is appearing. Query: What could be causing the space ab ...

Tips for retrieving the current value of an input using AJAX

Currently, I am in the process of developing an e-commerce website using Laravel. One issue I am facing is capturing the new value of an input when it changes. This input is located on the cart page where users have the option to adjust the quantity of a p ...

How can I create a unique visual effect on the background in frontend development using chipped design techniques?

Creating a static website utilizing React. Description I am looking to incorporate a visual effect into the website pages, similar to the one demonstrated below. visual effect The goal is to design a rectangular background with triangles cut out from it ...

Layout your Angular components with a column design using Flex Layout

Is there a way to adjust the width of a child component in an fxLayout set to column? Take this example for reference: https://stackblitz.com/edit/angular-fxlayout-custom-breakpoints?file=app%2Ftest.component.ts In the provided example, there are three f ...

Troubleshooting a JQuery accordion malfunction within a table

I am populating the data dynamically. However, the Accordion feature is not functioning correctly. JSFiddle link http://jsfiddle.net/aff4vL5g/360/ Please note: I am unable to modify the HTML structure. Current table Desired output The first accordio ...

unable to display loading image prior to upload

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html lang="en"> <head> <title>Unique Prints</title> <meta charset="utf-8"> <meta name="viewport" conte ...

Progressively increasing the time by 15 seconds during each iteration of the CSS @each loop

I recently made changes to a CSS script that involves the repetition of an animation task. Rather than repeating a segment of code 30 times, I decided to streamline it using a loop. Now, there are 30 <div></div> segments and each one undergoes ...

The image is taking up the entire div instead of just filling the area below the header

I'm currently facing an issue with positioning an image within a container below a header. The problem lies in the fact that the image extends beyond the header's position, filling up the entire container. Below is the code snippet I'm work ...

Tips for preventing extra whitespaces and line breaks from being added to the render tree in Blazor applications

Consider the code snippet below <div> @for (int i = 0; i < 10; i++) { <span class="@classes[i]">@i</span> } </div> The desired output is (with each character styled differently) 01234567890 Howev ...

Tips on keeping a div element in a fixed position until triggered by jQuery

I've managed to create a navigation bar within a header that sticks to the top of the screen once you scroll down past 100px. The functionality works well, but I'm looking to make the navigation bar stay fixed on the right until it snaps, essenti ...

What exactly does original-title refer to in HTML coding?

I have been searching extensively, but I cannot find any information that explains the meaning and proper usage of the original-title in HTML code. I am unsure if original-title is a Tag or Attribute in HTML, and if it is the same as title? I came across ...

Switching the color of the nav-link in Bootstrap

Struggling to change the color of my Bootstrap's nav-link to white with no success. Here is my code snippet: <nav class="navbar navbar-light" style="background-color: #5E9DFE;"> <a class="navbar-brand" href=& ...

How can I ensure that the size of the Dropdown Menu Item matches its parent in both Bootstrap and CSS styles?

I am working on a navigation bar that has a dropdown menu which appears on hover. I want the size of the dropdown menu items to match the size of the parent element. Here is an image for reference: https://i.stack.imgur.com/oNGmZ.png Currently, the "One ...

Utilizing React for incorporating HTML5 canvas gradients

I'm currently working on an app that allows users to generate a background gradient with two distinct colors using React. The issue I'm facing is that while the first color appears correctly, the second color ends up looking more like a solid col ...