Create a form with two divs inside: one positioned in the middle and the other at the bottom

I have organized a responsive form of div with a central and bottom alignment. The code I have included is as follows:

<link href="../css/bootstrap-theme.min.css" rel="stylesheet" />
<link href="../css/bootstrap.min.css" rel="stylesheet" />
<link href="../css/splashscreen.css" rel="stylesheet" />

<body class="container container-table">
    <div class="text-center col-md-12 col-md-offset-12 vertical-center-row">
        <img class="img-responsive center-block imageCenterContentFirst" src="../images/disegno11.svg" />
    </div>
    <div class="col-md-offset-12 vertical-bottom-row">
        <img class="img-responsive center-block imageCenterContentSecond" src="../images/logo_macnil_zucchetti.svg" />
    </div>
</body>

CSS:

html, body, .container-table {
    height: 100%;
    width: 100% !important;
    padding: 0;
    margin: 0;

}
.container-table {
    display: table;
}
.vertical-center-row {
    display: table-cell;
    vertical-align: middle;
    width: 50%;
}
.vertical-bottom-row {
    display: table-cell;
    vertical-align: bottom;
}

.imageCenterContentFirst {
    width: 100%;
}

The two div elements are not aligning correctly as expected. Instead, they appear side by side as shown in this image. In the image, the red section represents the first image, the purple section represents the second image, and the white areas with the others are where the two div should be stacked on top of each other.

I am puzzled by why one image is not positioning itself below the other.

Answer №1

To have the two divs shown one on top of the other, consider using display: table-row instead of table-cell within display: table; as direct children. Additionally, ensure that one of the divs is set to a width of 50%.

.container-table {
    display: table;
}
.vertical-center-row {
    display: table-row;
    vertical-align: middle;
    background: red;
}
.vertical-bottom-row {
    display: table-row;
    vertical-align: bottom;
    background: violet;
}

Check out this jsfiddle example for reference.

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

Responsive Bootstrap 5+ carousel featuring cards tailored to different viewport sizes

After an extensive search, I have come across numerous outdated questions and answers regarding my issue. With Bootstrap continuously evolving, I am hoping someone can help me with my specific requirement. I am in need of a carousel of cards that adjusts ...

I'm puzzled as to why the navigation bar isn't staying fixed

I recently created a landing page using Bootstrap, but I'm having an issue with the navbar not being fixed. Here is the code for the navbar: <nav class="navbar fixed-top navbar-inverse bg-primary navbar-toggleable-md navbar-light bg-faded"> < ...

Is it possible to dynamically change the color of a box shadow using an event handler?

I'm currently in the process of developing an application that consists of six distinct topics organized within a flexbox structure, complete with a box-shadow effect. My objective is to dynamically alter the color of the box-shadow through an event ...

Tips for generating click event with Angular directive

I am completely new to AngularJs directive creation. I have created a directive where, when the user clicks on the delete button, I am trying to print the values of scope, element, and attrs in the console. However, nothing is getting printed. The json dat ...

Loading Kendo JS on the client side proves to be rather time-consuming

Working on my project, I have encountered a problem with the kendo ui scheduler where the downloading of the kendo js and css files on the client side is causing slowness on our website. To address this issue, we are attempting to download the kendo js and ...

What is preventing me from setting the height of the buttons to be the same as their width?

My website needs a panel on the left side of the screen that contains square buttons, each button representing a different action. However, currently these buttons are stretching horizontally when they should be stretched vertically to match my UI design: ...

Improving the method for adding an element to an HTML document with jQuery

What is the best way to add this element to a specific DIV Class using JQUERY in an optimized manner? The elements are generated dynamically and I want to use .AppendTo to display them inside <div class='parent-list-workorder'>. This is wh ...

Flexbox layout to achieve equal height columns with content centered

In search of a solution to create two columns with equal height and center-aligned content within each column, while also maintaining different widths. Issue: The challenge lies in achieving both 'equal height' and 'middle aligned' at ...

Pandoc fails to display SVG images when converting HTML to DOCX

I am currently utilizing pandoc for the conversion of a standalone html file (without external dependencies), incorporating all necessary css and js within the html itself. Within this HTML document, there are several svg graphs that have been generated th ...

No information available at the moment

When the data is not present, it displays as "display none"... However, I want it to show "no data found" This is the current code if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { li[i].style.display = ""; } else { li[i].styl ...

Issues with jQuery animate not functioning properly when triggered on scroll position

I found a solution on Stack Overflow at this link, but I'm having trouble implementing it properly. The idea is to make an element change opacity from 0 to 1 when the page is scrolled to it, but it's not working as expected. The element is locat ...

What is the best way to position a popup div in CSS?

Currently, I am in the process of developing a website that displays DVD details when hovering over an image, similar to what is shown in picture 1. However, I've encountered an issue where the content gets cut off for DVDs located on the right side o ...

Customize Your AJAX POST URL with Radio Buttons - A Step-by-Step Guide

I'm looking for some guidance on how to use AJAX to change the post URL based on a radio button selection. Do I need to use an if statement or is there another way? var barray = []; function cbutton() { $('input:radio[name="cheking"]:checke ...

Tips on changing the button ID within a class based on a condition in JavaScript?

Currently, I am utilizing ChartJS to create a pie chart where elements are added each time the user clicks on a specific button. There are 14 buttons in total that trigger the addition of a specific element to the pie chart. Each button activates a functio ...

Applying CSS text-shadow to an input field can cause the shadow to be truncated

I've encountered an issue when applying text-shadow to an input field, where the shadow appears to clip around the text. Here is the CSS code I used: @import url('https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900& ...

I want to organize the divs in groups of 5 by 10

I need help arranging a 5x10 grid within a larger box with equal spacing between all the boxes. However, depending on the size of the smaller divs, there could be six in a row. The same applies for justify-content and align-content after specifying in pixe ...

Navigate to the table cell located directly underneath a specified cell within an HTML table

Below is a table for reference: ------------------------------------------ | category 1 |category 2| category 3 | |------|---------|--------|---------------- |item1 |item2 | item3 | item4 | |--|---|--|------|---|----|------|----- ...

Uniform design across various phone screen sizes achieved using JQuery Mobile framework

When I use phone with different screen resolutions, the layout appears differently. Desired Outcome Result when resolution is increased Is there a simple way to make it scale proportionally using JQuery Mobile? ...

Modify the shading of the mesh generated with the face3 method

I have utilized face 3 and three js to generate a mesh, but the expected color is not displaying correctly on the mesh. Below is the code snippet I used: var geometry = new THREE.Geometry(); var f = 0; for (var i = 0; i < data.real.length ...

Using dojo.dnd.moveable in a fixed position setting

I have been attempting to use a Dojo moveable with a fixed position on the browser window. Unfortunately, whenever I try to move the div using the mouse, the position automatically changes to absolute. Is there a way to keep the div fixed in its position? ...