Using ng-repeat to locate the position of three-dimensional objects

Looking to achieve a final result similar to the illustration attached in the link provided. Each block in the picture is its own PNG image drawn using Illustrator and assigned with a specific CSS class.

The challenge I am facing is how to position each individual block to recreate this layout. Which CSS properties should I modify to achieve the desired positioning?

I have realized that centering them vertically may not give the intended look as they need to be aligned differently.

In the past, I have used ng-repeat to draw circles as round div elements, but encountered issues with arranging them in multiple dimensions.

If you have any suggestions on how to accomplish this or important considerations to keep in mind, please share.

You can view the fiddle here: https://jsfiddle.net/tyt4ft3g/1/

Answer №1

Your approach is spot on and the most effective way to achieve the desired outcome for that object.

To achieve this, you need to assign position: absolute to all img elements and make sure they have a common parent with the style attribute position: relative. Properly position the images using the right and bottom properties so that each image appears centered relative to its predecessor.

Additionally, give higher z-index values to the images that should appear on top (i.e., smaller images on the left should have higher z-index compared to those on the right in descending order).

For an updated demonstration, check out the updated fiddle.

Refer to the code snippet below for a clearer understanding:

.parent {
  width: 300px;
  height: 200px;
  position: relative;
}

.copper {
  height: 30px;
  right: 72px;
  bottom: 28px;
  position: absolute;
  z-index: 3;
  content: url(http://i.imgur.com/LeIGPou.png);
}

.ins {
  height: 60px;
  right: 37px;
  bottom: 16px;
  position: absolute;
  z-index: 2;
  content: url(http://i.imgur.com/3bMaW3t.png);
}

.power {
  height: 70px;
  right: 0;
  bottom: 16px;
  position: absolute;
  z-index: 1;
  content: url(http://i.imgur.com/jFYquAI.png);
}
<div class="parent">
  <img class="copper">
  <img class="ins">
  <img class="power">
</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

Customizing CSS for AGM Info Windows

After creating an agm-info-window with an image and a small text (tittle), here is the code: <agm-marker [latitude]="lat3" [longitude]="lng3" [iconUrl]="icon"> <agm-info-window [disableAutoPan]="true" [isOpen]="true"> <div route ...

Changing the text color of Material UI Accordion Summary upon expansion

How can I update the color of an Accordion summary text in Material UI when it is expanded? <Accordion expanded={expanded === 'panel1'} onChange={handleChange('panel1')} className={classes.root}> <AccordionSummary ...

Identifying the right time to apply CSS coding techniques

Currently, I am customizing a CSS file in a WordPress theme setup. Throughout the CSS code, there are instances where I need to designate something as '.example', sometimes as '#example', and occasionally it can just remain 'examp ...

Tips for automatically adding `.withGraphFetched()` to all model queries in objection.js

In my code, I have defined the following model: import db from "../connection.js"; import objection from "objection"; const { Model } = objection; Model.knex(db); class User extends Model { static get tableName() { return "users"; } static ge ...

How to enable checkbox return in PHP arrays

I recently created a form on a website where users can input their name and provide links to their favorite websites. I wanted the form to submit without reloading the page, and also required users to accept the terms and conditions before submitting. Afte ...

Expanding Vue Tabs with Bootstrap: Manipulating tab-content to perfectly fill parent height

On my webpage, I have implemented a tabs component called b-tabs. This component is enclosed within a parent div with a specific height. I am trying to make the content of the tabs take up the full remaining height of the parent component. https://i.ssta ...

The Empty Spaces Surrounding the Navigation Bar in HTML/CSS

I am just starting out with CSS and HTML. Is there a way to eliminate the gaps around my navigation bar? Here is an example image showing the gaps around the navbar. I have attempted using width and height attributes but it did not resolve the issue. ...

What is the best way to trigger a filter function that has been stored in a variable?

I need assistance with executing a filter function stored in a variable when the user clicks a button. The function enableFilter must compare item.id with item.category and trigger the filter if they match. Can someone provide guidance on how to achieve ...

Display the view once the data has finished loading

I'm encountering a problem with the "angular-masonry" plugin from Github that I am using to create a dynamic grid on my page. When the page first loads, it looks like this: My code snippet is as follows: <div class="container" style="width:80 ...

`Javascript framework suggests ajax navigation as the preferred method`

What is the best way to handle ajax navigation using jQuery? I have recently experimented with a simple jQuery ajax code to implement ajax-based navigation for all the links on a webpage. $('a').click(function(e){ e.preventDefault(); ...

Struggling to figure out the right way to make a CSS selector for the Yahoo stocks page

In my quest to accurately retrieve the number located directly beneath the title with the symbol, I am transitioning from using xpath //div[@class='title']/following::span[2]/text() to experimenting with css selectors in Jsoup. Despite trying var ...

Is there a way to pause the animation when scrolling back to the top in the animate.css library?

Currently, I have integrated the react-animate-on-scroll package which is using the animate.css library to animate text on a web page. However, I am only looking to bring about the animation effect when scrolling down and not while scrolling up. Is there ...

Why doesn't vuex4.0 function properly as hooks when used within a Vue3 onMounted async function?

When foo() is completed, I need to choose one of bar1(), bar2(), or bar3() as the actual function to be sent to the web socket and store the callback value in vuex. 1. bar1(): If I include bar1() in the onMounted scope, it does not work and the store beco ...

What are the disadvantages of nesting CSS Grids within each other?

I have been exploring component-driven front-end frameworks like Angular and honing my skills in CSS Grid. My query is: Is it considered a bad practice to nest CSS Grids? In my main/root component, I have utilized CSS grid to create two elements: the nav ...

What is a more efficient way to avoid duplicating code in javascript?

Is there a way to avoid repeating the same code for different feeds? I have 8 feeds that I would like to use and currently, I am just incrementing variable names and feed URLs. <script type="text/javascript> function showFeed(data, content ...

Guide to redirecting on click when utilizing an iframe

I needed to prevent the page from reloading before the action was complete by using an iframe. However, I encountered an issue where I needed the page to refresh after the action took place. I attempted two methods to achieve this - refreshing the page and ...

Experience the impact of a lagging network connection on Chrome extensions through the power of React-NextJS

I'm currently working on a Chrome extension that requires me to limit download speeds in the browser programmatically (client-side). Despite researching extensively on the subject, I have not been able to find any information on how to achieve this us ...

What is the best way to iterate through one level at a time?

Imagine a scenario where the structure below cannot be changed: <xml> <element name="breakfast" type="sandwich" /> <element name="lunch"> <complexType> <element name="meat" type="string" /> <element name="vegetab ...

Customize border color for a single cell in a table using Bootstrap 4

I'm facing an issue where I'm trying to apply a red border color to a specific cell, but it's not appearing on the top and left sides of the cell. It seems like the border color of other cells is taking precedence over the one I'm tryin ...

Can the current website navigation be integrated into the blog script?

People might see me as a spoil sport for not using Wordpress, but I prefer a flatfile blog system for my small site. Currently, I am using the ozjournals-3.2 blog system. I need assistance in installing a header and site navigation on top of the blog page ...