organize divs in a nested angular style

Looking to showcase div elements in a specific layout within my Angular project:

https://i.sstatic.net/RH0lF.png

The current HTML structure is as follows:

<div class="outer-wrapper">
    <div class="image" ng-repeat="image in images" ng-if="showImages" ng-click="imageClick(image.id, image.color)">
        <img src="{{image.path}}">
    </div>
</div>

<div class="inner-wrapper">
    <div class="box {{box.color}}" ng-repeat="box in boxes" ng-class="{'lit': box.isLit}" ng-click="boxClick(box.id)" ng-audio="sounds/beep-08b.mp3" volume="0.5">
    </div>
</div>

Here is the corresponding CSS:

.outer-wrapper {
    position: fixed;
    top: 160%;
    left: 32%;
    width: 300px;
    height: 300px;
    background-color: #ddd;
}
.inner-wrapper {  
    position: fixed;
    top: 300%;
    left: 40%;
    width: 150px;
    height: 150px;
    background-color: #9e9e9e;
}

/* Rest of the CSS properties */

Current output:

https://i.sstatic.net/Hxd2G.png

I am looking to modify my html/css to arrange these images at corners while ensuring they remain responsive. Any suggestions?

Answer №1

Feel free to use this example for reference [view in full screen]

        var application = angular.module("application", []);

        application.controller("controller", function ($scope) {

            $scope.cubes = [
                { color: "purple" },
                { color: "orange" },
                { color: "pink" },
                { color: "cyan" }
            ];

            $scope.pictures = [
                { path: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLFhLVwWJyYrBfA685OS2POx_jIFlZXoZ8YKfsKnfxD7pa9UqTiE9P6t64" },
                { path: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLFhLVwWJyYrBfA685OS2POx_jIFlZXoZ8YKfsKnfxD7pa9UqTiE9P6t64" },
                { path: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLFhLVwWJyYrBfA685OS2POx_jIFlZXoZ8YKfsKnfxD7pa9UqTiE9P6t64" },
                { path: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSLFhLVwWJyYrBfA685OS2POx_jIFlZXoZ8YKfsKnfxD7pa9UqTiE9P6t64" }
            ];
         });
 .container {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .inner-container {
            height: 200px;
            width: 200px;
            background-color: #9e9e9e;
            padding: 10px;
            position: relative;
        }

            .inner-container .cube {
                width: 45%;
                height: 45%;
                display: inline-block;
                padding: 0;
                margin: 0 5px 16px;
            }

                .inner-container .cube.orange {
                    background-color: orange;
                }

                .inner-container .cube.cyan {
                    background-color: cyan;
                }

                .inner-container .cube.pink {
                    background-color: pink;
                }

                .inner-container .cube.purple {
                    background-color: purple;
                }

            .inner-container .outer-container .picture {
                width: 100px;
                height: 100px;
                position: absolute;
                margin: 0;
            }

                .inner-container .outer-container .picture:nth-child(1) {
                    top: -120px;
                    left: -100px;
                }

                .inner-container .outer-container .picture:nth-child(2) {
                    top: -120px;
                    right: -100px;
                }

                .inner-container .outer-container .picture:nth-child(3) {
                    bottom: -120px;
                    right: -100px;
                }

                .inner-container .outer-container .picture:nth-child(4) {
                    bottom: -120px;
                    left: -100px;
                }

                .inner-container .outer-container .picture img {
                    width: 100%;
                    border: solid 1px #ccc;
                }
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<!DOCTYPE html>
<html ng-app="application" ng-controller="controller">
<head>
    <title></title>
    <meta charset="utf-8" />
    
</head>
<body>
    <div class="container">
        <div class="inner-container">
            <div class="cube {{cube.color}}" ng-repeat="cube in cubes"></div>

            <div class="outer-container">
                <div class="picture" ng-repeat="picture in pictures">
                    <img ng-src="{{picture.path}}">
                </div>
            </div>
        </div>
    </div>
    </body>
</html>

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

Leverage the power of the General Sibling Selector to easily traverse through deeply nested elements in your

Hi there, I have a query regarding the General Sibling Selector. Let's start by looking at the HTML: <div id="layout-middle"> <div id="Center"> <a class="col Picture1">Title1</a> <a class="col Picture2">Title2< ...

AngularJS is encountering issues with dependency injections when using WebStorm and TypeScript

A TypeScript AngularJS component: class MyComponentCtrl { static $inject = ['MyService']; constructor(private MyService) { MyService.testfn(55); // No error in typescript } } class MyComponent implements ng.IComponentOptions { ...

Changing the color of the timePicker clock in material-ui: a step-by-step guide

I have been attempting to update the color of the time clock in my timeInput component (material-ui-time-picker) for material-ui, but unfortunately, it is not reflecting the change. Here is the code I am using: <TimeInput style ={heure} ...

Changing the content of a PHP div with an Ajax callback inside another Ajax callback?

In the index.php file, there is a script that triggers an ajax call when a header element is clicked. This call sends a $selection variable to ajax.php, which then replaces #div1 with the received HTML data. <script> $(document).ready(function(){ ...

Setting the dimensions of an HTML - CSS block

I am trying to style a navigation bar using the following CSS code: #nav {} #nav a { position: relative; display: inline-block; color: #F0F0F0; width: 1em; height: 2em; line-height: 0.9em; } #nav a.ic ...

Adjusting the dimensions of a Twitter widget to fit the screen size

My website is designed to resize based on screen size, but I encountered an issue when adding a Twitter widget. Despite setting the attribute width:'auto', the widget did not resize properly. Below is the code for the widget: <script charset= ...

Changing the Image Path According to the Device's Retina Ratio

I'm currently setting up a website for a photographer and working on creating a gallery. To streamline the process, I have automated many aspects such as file names, paths, widths, lightbox classes, etc. All I have to do in the HTML is write an <a ...

The text loader feature in THREE.js is failing to load

My first attempt at coding THREE.js resulted in a black screen when I tried to load the Text loader. Can someone help me resolve this issue? I kept getting the following error even after multiple attempts: three.module.js:38595 GET 404 (Not Found) ...

Utilizing Multiple Checkboxes for Precision Search Refinement

Big thanks to Khalid Ali for the support provided up until now. I am currently working with an array of songs that each have descriptions, keywords, etc. I have a set of checkboxes that I want to use to refine a search. Essentially, if someone selects the ...

Saving information to a hidden div using jStorage

Currently, I am utilizing jStorage for storing data in local storage. When I store the data using console.log() and later retrieve it using $.jStorage.get(), I found that the values are not being assigned to the hidden div. Can someone provide guidance o ...

Unable to achieve text centering within a button using HTML and CSS

I'm diving into the world of HTML/CSS for the first time and encountering some issues along the way. In my setup.html, I created a "Continue" button and applied a class to style it in styles.css. However, I'm facing an issue where text-align cen ...

Learn how to stream videos using the YouTube Player API's loadPlaylist feature

Is there a way to make the next video play automatically using the loadPlaylist option? I've tried implementing this code but unfortunately, it doesn't work and the video won't play: <div id="player"></div> <script> var ...

The hierarchy of CSS in Vue components

I've developed a customized CSS framework to streamline the design process across all my internal projects. The central file is structured as shown below: @import "~normalize.css/normalize.css"; @import "_variables.scss"; @import "_mixins.scss" ...

React Tabulator - custom header filter for select column - hide 'X' option

Is it possible to remove the 'x' option on header filters in react tabulator columns? The issue arises when users click the 'X' to clear a filter, as expected. However, if they then try to click on the same filter for another list item ...

Modify NgbPopover location if window size is smaller than X

I am currently utilizing Angular 4 along with the Popover component from ng-bootstrap. Everything is functioning properly, but I am attempting to adjust its placement if the window size is less than 600px. Unfortunately, I have not come across an option fo ...

Unable to exceed a width of 100% in Asp.net Tables

I searched for similar inquiries without success. Here is a snippet from my aspx file: <div align="center" style="height: 350px; overflow-y: scroll; overflow-x: scroll; width: 100%;"> <asp:Table ID="tblReport" Font-Size="11px" runat="server" ...

Incorrect Display of Datepicker Position

Trying to display a datepicker in a modal, but the output is not as expected: The datepicker is appearing in the wrong place. However, it works fine when testing on jsfiddle. Here is the link: http://jsfiddle.net/alverhothasi/D7bBg/ Currently using the ...

Angular JavaScript does not take effect on elements inserted into ui-view

When transferring the code from main.html to index.html, the javascript functions smoothly. The click function successfully triggers the ripple effect. Link: Ripple Click Effect Google Material Design However, upon extracting the code to main.html and in ...

If additional content has been included in the `div`, be sure to scroll all the way down to view it

I have a div that needs to automatically scroll to the bottom when new content is added. This is a common feature in chat applications where the user wants to see the latest messages without having to manually scroll down each time. How can I achieve this ...

Arrangement of items in a grid featuring a row of three items, each with an automatic width

I'm facing challenges with achieving a specific layout: My goal is to have the left and right elements automatically adjust their width to cover all the empty space on either side of the center element. Here is what I've tried so far, but I&apo ...