Begin by implementing Bootstrap in the initial container to supersede the functionalities

My webpage design using bootstrap features two containers as follows: First container :

  • A white column taking up 7/12 of the first row
  • A black column taking up 5/12 of the second row Second container (below the first one)
  • A grey panel

The first container occupies the entire page and when you scroll down to the second container, it also fills the entire page height

HTML :

<div class="container-fluid h-100 nopadding">
    <div class="row h-100 nopadding">
        <div class="col-md-7 left nopadding">
            left
        </div>
        <div class="col-md-5 right nopadding">
            right
        </div>
    </div>
</div>

<div class="container-fluid h-100 padding">
    <div class="row h-100">
        <div class="col details nopadding">details</div>
    </div>
</div>

CSS :


html,
body {
    height: 100%;
}

.nopadding {
    margin: 0 !important;
    padding: 0 !important;
}

.left {
    background: white;
    color: black;
    height: 100%;
}

.right {
    background: black;
    color: white;
    height: 100%;
}

.details {
    background: grey;
    color: white;
    height: 100%;
}

Below are screenshots of the page layout. When there is enough room for the black column, everything works fine. However, resizing the window causes the black column to go under the grey container [observed by z-index]) :

https://i.sstatic.net/ZkwnC.png https://i.sstatic.net/OqSFz.png

https://i.sstatic.net/pcHRl.png https://i.sstatic.net/Ncl6E.png

I want the black column to be positioned directly below the white one when resizing, and the grey column to move underneath the black column upon resize.

Thank you!

Answer №1

It seems like there may be some misunderstanding about the capabilities of h-100 and how it interacts with CSS. By setting the container and row height to h-100 and then defining .left and .right with a height of 100%, you might run into issues where the "right" element is hidden because the "left" element has taken up all available space.

Instead of reinventing the wheel, consider utilizing Bootstrap classes or simple CSS to achieve your layout goals without encountering these problems.

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

Exploring the world of Bootstrap Twitter 3.0 alongside the wonders of Knockout

When utilizing Twitter Bootstrap, the validation classes like has-error or has-warning must be added to the wrapping form-group element to style both the input and its label. However, Knockout-Validation directly adds the class to the input element itself. ...

When viewed on a mobile device, the entire HTML document is resized to occupy less than half of the

Whenever I adjust the size of my webpage on different devices or mobile phones, I notice that the <div> tag appears to be only half (or even less) the width of the page. This gap seems to increase as the window size decreases. Refer to the screenshot ...

Issues with Laravel 5.8 and Bootstrap not functioning properly in Jquery

Check out this link for using Bootstrap Select. The code works perfectly in the view, but when I try to implement it with jQuery below, it doesn't work. Can someone help me fix this issue? View Code: <table id="tableAppointment" style=&q ...

Positioning buttons alongside a contact form

Having trouble aligning three buttons next to a contact form. Placed them in a row class but the buttons keep falling below the form. Even tried using float: right but they still end up underneath. Any assistance would be appreciated, thank you! If you wa ...

Achieving a sidebar that remains full height with CSS

Currently working on this page () where my aim is to create a sidebar that fills the entire height of the screen. The goal is for the sidebar, along with the black line on its right, to always reach the bottom of the viewport. JSFiddle Link Here's t ...

Refreshing the lightbox once new ajax content is loaded

While there are similar questions and answers related to my issue, I have not been able to apply them successfully. As a beginner in this area, any assistance is greatly appreciated. I am currently working with CubePortfolio, which is a jQuery-based, filt ...

How to extract a one-of-a-kind identification number from the browser using just JavaScript in a basic HTML file?

Is there a way to obtain a distinct identification number from a browser without resorting to techniques such as generating and storing a unique number in cookies or local storage, and without utilizing a server-side language? ...

Maintaining duplicate values in a JSON stringify operation: Tips for retention

Server responses are being received in JSON format, which may contain objects with duplicate keys. When displaying the results, I noticed that only the last value for duplicate keys was showing up. After investigating, I realized this was due to using the ...

Issues with the functionality of customisable list items in a list

I am attempting to customize the appearance of specific list items within a ul element. One li element should be displayed in red font, while another li element should have a hyperlink styled with a different color and an underline rollover effect. The thi ...

The attribute aria-required is necessary for a radio group

When creating a required radio group, how should the aria-required="true" attribute be assigned? Specifically, I have multiple <input type="radio"> elements with the same name grouped under a <fieldset>. Should the aria-required be placed o ...

Activate Popover on Third Click with Bootstrap 4

Is it possible to create a button that triggers a popover after 3 clicks and then automatically dismisses after one click using Bootstrap v4.3.1? Code: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.mi ...

Style condition within an HTML element

Can you apply conditional styling within the <head> tag as demonstrated in the following example? <body> <div id="InScreenAlertContainer" <!--[if IE]> <style>width=100%</style> <![endif]--> > ...

conceal the spinner loading animation once the script has finished executing

I'm having trouble displaying the spinner at the beginning of an AJAX call and hiding it once the call is complete. Unfortunately, I cannot seem to hide the spinner after the script has finished executing. Any suggestions or ideas on how to solve thi ...

What is the best way to eliminate the underline text decoration from a link element?

Take a look at this JS Bin. I want to change the link Project name in there. By default, it is underlined when hovered over. How can I remove that effect? I attempted using a class project-name: a:hover, a:focus .project-name { text-decoration: non ...

Scroll sideways with AJAX content replacement

I've successfully discovered various methods for loading and replacing content with ajax, as well as ways to hide/show with effects. However, I'm now seeking a technique that allows the new content to slide into a div while the old content slide ...

php$insert new field into mysql table using form insertcell

How do I insert a column in MySQL? I am struggling with the insertCell form. I have tried but I can't seem to add a MySQL column using my JavaScript code with PHP. I am familiar with Php PDO, but this seems difficult to me. Can someone guide me on ho ...

Bootstrap Carousel unable to transition to the next image

I cannot seem to interact with the arrows or dots on the carousel. How can I set it up to automatically transition to the next slide? I have tried various solutions but nothing seems to work. Any assistance would be greatly appreciated. Thank you! Below i ...

Deconstructing JavaScript scripts to incorporate HTML5/CSS3 functionality for outdated browsers such as Internet Explorer

I have been researching various resources and guides related to different scripting libraries, but none of them seem to address all the inquiries I have regarding performance and functionality. With so many scripts available, it can be overwhelming to dete ...

Having trouble displaying Json data on an HTML page?

I am trying to incorporate a local JSON file into an HTML page using JavaScript. I have successfully loaded the data from the JSON file into the console, but I'm encountering issues when trying to display it on the HTML page. Could someone please revi ...

Is it possible to maintain the x-axis in a fixed position while scrolling with d3.js?

I am working with a d3 matrix that has both an x and y-axis. However, my y-axis is quite long, so I want to ensure that the x-axis remains visible even when scrolling. I have tried setting the position attribute to 'fixed' using .style("position" ...