Elements stacking up in succession

I am having issues with the alignment of my div elements, as they are either stacking behind or on top of each other.

td {
    width: 14.28%;
    height: 16.6%;
    position: relative;
    }

.details {
    position: absolute; 
    display: none;
    background-color: gray;
    overflow: visible;
    border: 2px solid black;
    } 

div:hover > .details {display: block;}
<table>
<tr>
<td *ngFor="let cell of ukeEn()">
                {{cell.text}}
                <div class="outer" *ngIf="datoerContains(cell) != null">
                  <div class="circle" *ngFor="let circle of datoerContains(cell)"></div>
                  <div class="details" *ngFor="let circle of datoerContains(cell)"> 
                    {{circle.skole}} <br>
                    {{circle.kommentar}} <br>
                    SFO: {{circle.sfodag}}
                  </div>

                </div>
            </td>
</tr>
</table>

The issue I'm facing is related to the details class. When using *ngFor, multiple div elements are generated but only one is visible while others remain hidden.

Any suggestions? I plan to experiment with displaying them next to each other and below each other without removing the absolute positioning from the .details class which serves another purpose.

Answer №1

After some experimentation, I was able to discover a solution on my own. I decided to eliminate the position attribute from both td and .details, and instead included position: absolute for .outer. This adjustment caused them to align perfectly below each other. In order to have them positioned next to each other, I simply inserted float: left into the details section.

td {
    width: 14.28%;
    height: 16.6%;
}

.outer {
    position: absolute
}

.details {
    display: none;
    background-color: gray;
    overflow: visible;
    border: 2px solid black;
    float: left;
} 

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

Is there a way to trigger both the link and the div element simultaneously?

Is there a way to make both the button and the link light up simultaneously when hovering over the div element, instead of just the button lighting up first? <div id="b1"; class = b> <a href="test.html">BUY</a> < ...

Utilizing Ajax to dynamically update the color of a button when it is clicked from a different device

Currently, I am developing a program for my own use within my local community theater. The setup will involve a computer in the control room (Sound Booth) and another computer backstage. My plan is to create a grid of around 10 interactive "buttons" on th ...

I'm attempting to make it so that when users click on this link, it opens in a new tab instead of directing them away from my website. Unfortunately, using _blank

The link I have is currently opening in the same tab, but I want it to open in a new tab to keep users on my site. I've added target="_blank" to the code, but it's not working as expected. <BottomNavigation className={classes.root}> &l ...

Functionality that can be utilized repeatedly

I've been struggling to implement a feature for repeatable blocks in my web form. The issue I'm facing is that when I click the buttons, nothing happens even though they work fine when tested in the console. I've been stuck on this problem f ...

Ignored are the white spaces within a pre tag

From what I understand, the 'pre' tag is supposed to collapse all white spaces and tabs into one space. However, I have noticed that this doesn't happen for me. I'm curious as to why this may be the case. Could it possibly be dependent ...

Troubleshooting issue with Bootstrap's responsive scrollspy functionality

I am experiencing an issue with the responsiveness of my page. When I reduce the width of the page to half, the scrollspy disappears unexpectedly. I am unsure about the root cause of this problem. If you run the code I have shared here, you can observe th ...

Incorporate vanilla JavaScript and HTML into a Next.js application

I am facing an issue where I have a file that contains JavaScript and HTML code, which needs to be rendered within a Next.js application. The challenge is that the code in the file cannot be converted to JSX, and React Helmet does not seem to render anythi ...

The hyperlink is malfunctioning

Seeking assistance with this issue. The menu items below (Get on Amazon etc) are able to change the information displayed on the page, however, the first menu should redirect to my index page but it's not working for some reason. <!DOCTYPE html> ...

The wonders of CSS flexbox and the power of justify-content

I am working on a layout where I need three flex items (rows) in a flex container, and my requirement is to justify them as space-between... The first row will consist of cloud tags, the second will have a price, and the third will contain a Read more link ...

PHP displays an HTML table with error messages

I recently created a table by extracting data from a database using a loop to retrieve all the necessary information. However, I encountered an error after calling a javascript function in the HTML onClick event of an input element. The function itself wor ...

Is there a way to seamlessly transition between different Angular components without having to refresh the entire webpage?

I'm currently working on implementing a navigation bar that allows users to switch between three components without having the navbar reload. The goal is for only the new component to load when the user clicks on a different section of the navbar, kee ...

Exploring ways to programmatically click on a button located beneath a text using the Selenium library in Python

I am interested in creating a bot that can automatically like comments on a web page. Each comment has a like and dislike button attached to it. The xPath for the comment is: //*[@id="commentText-40538697"]/span The xPath for the like button is: //*[@id ...

Take the information entered in an HTML form, add it to a JSON object, and save it in a MYSQL

I'm currently working on extracting data from a user registration form in HTML, converting it to JSON format, and then storing it in MySQL. Your assistance with this process would be greatly appreciated. HTML <form id="myForm" action="userInf ...

Is there a way to customize the CSS of a Bootstrap 4 data table

I recently incorporated a library from Bootstrap Datatables into my project. However, I'm having trouble modifying the CSS for the search bar and 'Excel' button. Is there a way for me to customize it with my own CSS? https://i.sstatic.net/x ...

Finding a nested HTML element within a frame using Selenium without the presence of an iframe

Currently, I am delving into the world of Selenium using python to automate form filling on a particular website. However, my efforts have hit a roadblock as I am struggling to identify any elements within a frame and encountering a dreaded NoSuchElementEx ...

Vue.js is experiencing functionality issues on mobile devices and other connected devices, however, it is operating smoothly on desktop devices when localhost is running

I recently ran into an issue while trying to run my Laravel project on localhost and connect it to other devices like mobiles and desktops/laptops using the local address. The function works perfectly on the hosting desktop but fails to work on other devic ...

Is it possible to enable a button as soon as input is entered?

I'm encountering a minor issue with my button's functionality. I am attempting to have the button enabled as soon as text input is entered into the text field, but currently it only becomes enabled after the focus has changed from the text field. ...

What is the best method for accessing and showcasing images in an ionic app?

Having trouble displaying images after executing the following command: ionic run ios The default ionicframework template is being used with the sidemenu, and no changes have been made to the app directory structure. An inline css is being used to speci ...

Extract data from the HTML element on an iPhone device

Currently, I am loading HTML contents into a list in the UILabel. I have successfully managed to remove the tags and append the contents together. However, there are specific instances where the content includes Is it y=2 or x>2,y<1 Hello x = 2,Wor ...

Tips on combining multiple HTML tags within a single div element

After extracting a value from an XML document using Javascript, I encountered a problem while attempting to generate multiple image tags based on that value. Despite my attempt with a for loop, only one image was being displayed. for(i=0; i<red; i++){ ...