The Bootstrap flip-card front and back are positioned side by side, not on top of each other

As a beginner in HTML/CSS/Bootstrap, I'm hoping someone can help me with my issue.

I'm working on creating a flip card that features a colored table on both the front and back, with different information displayed on each side. To add "axis labeling" to the table, I've included an extra column on the left side and below the entries. This table + axis labeling appears on both sides of the flip card. However, when the card is flipped, parts of the front + the axis labeling are visible to the right of the backside-card. How can I stack the cards on top of each other so that no part of the front side is visible when the back is up? (There should be axis labeling as well, but it does not display correctly in the code snippet so I have commented it out.)

.table#risikomatrix{
  width: 90%; 
  height: 90%;
}
.table td{
  border-top: 0px solid #121416;
}
#left_axis_front{
  background-color: white;
  border-right: 3px solid black;
  width: 0%;
  vertical-align: middle;
}
#left_axis_label{
  background-color: white;
  transform: rotate(-90deg) translateY(-18px) translateX(-110px);
  width: 0%;
  height: 0%;
  position: absolute;
  white-space: nowrap;
  font-size: 14pt;
}

#lower_axis{
  border-top:3px solid black; ;
}

#lower_axis_label{
  background-color: white;
  transform:translateY(-12px) translateX(50%);
  width: 50%;
  height: 0%;
  white-space: nowrap;
  font-size: 14pt;
}
.cell{
  width: 33.33%;
  position: relative;
}
.cell::after {
  content: '';
  display: block;
  margin-top: 100%;
}
.card {
  background-color: white;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border: 1px solid #f1f1f1;
  /* Centered alignment in card */
  text-align: center; 
  display: flex;
  justify-content: center;
}
.card#yellow{
  background-color:  gold;
}
.card#red{
  background-color:  red;
}
.card#green{
  background-color:  green;
}

.flip-card-big {
  background-color: white;
  width: 40%;
  height: 40%;
  /* perspective: 1000px; Remove this if you don't want the 3D effect */
}

/* This container is needed to position the front...

Answer №1

Initially, it is crucial to avoid assigning the same ID to multiple elements as it is considered bad practice and can lead to complications when JavaScript comes into play.

Solution:

.table#risikomatrix {
    width: 90%;
    height: 90%;
    margin: auto;
}

The <table> element is classified as a block level element, allowing for centering by adding margin: auto on the left and right if it does not span the entire width of its parent.

In this scenario, centering was required due to the back table being aligned on the right side when flipped, while the front table was positioned on the 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

Aligning elements of unknown width within a container of a specified width

Currently struggling to find a resolution to the following issue: Trying to create a navigation bar using a ul element set to a specific width of 530px with multiple li items nested inside. The goal is to have the li items evenly fill the 530px width wit ...

Customize dropdown menu with images using Bootstrap

Bootstrap-select (https://developer.snapappointments.com/bootstrap-select/) is being used in a project of mine. I'm interested in adding an image before the optgroup label, but it appears that the library does not have this feature built-in. I attem ...

Trigger the function in ng-change each time the same option is clicked repeatedly

Here is the code I am working with: angular.module("myApp", []).controller("myController", function($scope) { $scope.currentOption; $scope.showWindow = false; $scope.myOptions = [{ id: 1, name: 'This opens the window' }, { ...

Can images be placed on the border?

Hi there! I am trying to add an image on a border with a 100px solid width using CSS. I have experimented with positions and z-index, but I can't seem to get the desired effect. Any ideas on how to achieve this? Here is an example image: https://i.sst ...

How can we prevent the automatic redirection to the home page index.html?

The page you are trying to access contains data that you previously entered. Revisiting the page may result in repeating any actions you have taken. Do you wish to proceed? Upon refresh, this message appears and the form data is resubmitted to Flask. How ...

Instant Access to a Precise Slide

Using a slider named mySlider or SL_Slider, which is powered by the MooTools library. When on the page with the slider, there is a simple script for the href to call the appropriate slide: <a href="javascript:mySlider.numPress(3);">link</a> ...

Finding solutions for activating items and setting data sources in Bootstrap carousel thumbnails for Wordpress

I recently attempted to incorporate a bootstrap-powered carousel with thumbnails into my product slider. I managed to get it working for the main image (large image), but ran into issues when trying to resolve problems with the thumbnail section. Here is ...

Submitting Boolean Values via Ajax

I am facing an issue where I want to send a boolean value to my Node.js server, but currently, it is being sent as a string. I need the boolean data type to be preserved during the transfer process. However, when I check my mongodb database, it shows tha ...

Shrinking my content on mobile devices with the use of "<p>" tag

I've noticed my footer, header, and forms shrink on mobile devices, but the text on my privacy pages remains the same size. Is there an easy way to make this text shrink as well? Thank you .content { border: 1px solid transparent; margi ...

How can HTML be added in CodeBehind using C# in a WebForm?

I have a method that generates tools based on the number value inserted, and I also have another control called "DateTimePicker" that provides a textbox and date+time picker function. However, the issue arises when I call the dynamic_tools method and inse ...

Launching a CSS modal window using C# backend code

Here is my HTML code snippet: <a id="PopUp" runat="server" href="#openModal">Open me</a> // This code opens a pop-up window using HTML <div id="openModal" runat="server" class="modalDialog"> <div> <a href="#close" t ...

The footers on each page are not consistent

I have noticed that two pages utilizing the same CSS are displaying differently. Check them out here: 128.48.204.195:3000 128.48.204.195:3000/formats If you look closely, you'll see that below the footer, the /formats page appears to have no extra s ...

A collection of Bootstrap 4 cards displayed in a card-deck layout, each card varying

I'm currently experimenting with incorporating a card-deck in Bootstrap 4 that includes cards of varying widths. If you want to adjust the width of individual cards (or utilize classes like w-25, w-50, or w-75 for 25%, 50%, or 75% width options): ...

Submit data using PHP and then forward the user to the next page

I am looking for a way to send data to a page using $_POST and redirection without relying on JavaScript or manually writing HTML forms. Is there a solution that involves CURL instead? Any guidance on how to achieve this would be greatly appreciated! Thank ...

Exploring the versatility of using SVGs as reusable components

My page boasts a 5-star rating that I want to leverage Is there a way to reuse my SVG as a component? I'm keen on understanding how this can be done. <div> <svg xmlns="http://www.w3.org/2000/svg" width="16" height=" ...

Uncovering Concealed Labels in Chrome Browser

My CSS-based tab system is functioning properly, except for one label randomly disappearing in Chrome. To demonstrate the issue, I have created a simple example: http://jsbin.com/xexupiciru/edit?html,css,output Here is a snippet of the code related to a ...

Tracking the movement of a handheld device through GPS technology

I am interested in creating a mobile application that can track the real-time location of users who have the app installed on their devices. The concept is to allow one or more users to follow the movement of another user using GPS on a map. I plan to deve ...

Browser comparison: Chrome and Firefox - peculiar ID name causing table width difference without CSS. Suspected AdBlocking interference

There seems to be an issue with a table I have in Chrome. Whenever I change the ID name, it either sets the width to zero or doesn't display at all. You can view it here: http://jsfiddle.net/kdubs/W6GTE/ The specific line causing trouble is: <ta ...

When you hover over the Dropdown Menu, the Hoverable Dropdown Menu will automatically close

I am currently working on creating a dropdown menu that pops up when hovering over an item. However, I am facing two challenges: Once my mouse moves away from the item, the dropdown disappears. Therefore, I would like the dropdown to remain visible as lo ...

Making the child element expand to the full width of its parent while maintaining an overflow-x:auto property

Is there a way to stretch a child div without specifying fixed widths? Even when trying to wrap items and child in one wrapper div, the child div always takes up 100% width. Not full horizontal width. Thank you. .parent { background: skyblue; widt ...