Struggling to set up a vertical grid using CSS in Bootstrap 3

Currently in the process of working on my final project as a student.

Utilizing Bootstrap 3, I am striving to construct a grid that mirrors the structure depicted in the image below:

Thus far, I have only achieved success in creating grids that span horizontally by %100.

You are welcome to take a look at my project and see what I have accomplished here.

Initially, I tried developing the following class, but ultimately had to comment it out in my CSS due to some unexpected issues arising from it and the removal of body positioning.

body {
    position: relative;
}
.fluid-height {
    height: 100%;
    min-height: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
} 

Answer №1

To make your fluid-height div adjust to the screen height, try setting the height to 100vh:

.fluid-height { height:100vh }

For more control, you can also use vh units for different sections of your layout adding up to a total of 100:

.buffer-p { height:10vh; }
.fluid-height { height:90vh; }

If you're worried about browser support for vh units, consider setting up a fallback solution using Javascript as discussed in this post.

Answer №2

To achieve this design with Bootstrap, a solution is to assign specific heights to the first and last rows in your layout. One option is to utilize the viewport height unit (`vh`) for defining the heights, as demonstrated in this helpful Fiddle.

While you could opt for fixed heights for your rows, this approach may not be ideal for responsiveness. Using percentage values would require setting `html` and `body` elements to have a minimum height of 100%, however, this method can result in issues when content is dynamically added and the page expands.

Answer №3

To achieve the desired design effect, you can set both classes to use absolute positioning with a top and bottom of 0px for each class. Below is a snippet of code showing the adjustments I made based on your design:

.bg-black {
  background: #000000;
  position: absolute;
  bottom: 0px;
  top: 269px;
}
.bg-white {
  background: #FFFFFF;
  left: 25%;
  position: absolute;
  top: 269px;
  bottom: 0px;
}

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

Typescript tutorial: Implementing a 'lambda function call' for external method

The Issue Just recently diving into Typescript, I discovered that lambda functions are utilized to adjust the value of this. However, I find myself stuck on how to pass my view model's this into a function that calls another method that hasn't b ...

Eliminate the hazy white layer covering the exterior of an image that has been blurred using CSS

Hey there, I've encountered an issue with an image that transitions from blurred to unblurred when the dom is loaded. <div class="image-wrapper-container2"><div class="image-wrapper orig" style="background-image: url('https://www.w3scho ...

What is the best way to retrieve the value of a custom attribute from a dropdown list using either JavaScript or jQuery?

I have a dropdown list on a web form and I need to have a 'hidden' variable for each item in the list that can be retrieved using the onchange event on the client side. To achieve this, after databinding the dropdownlist, I am setting a custom at ...

The CSS selector ">" is not functioning correctly, and neither is the "~" selector

I am currently working with the following CSS: .images_container input[type="checkbox"]:checked > label { border-color:#4378c3; opacity:1.0; } .images_container input[type="checkbox"] > label:hover { opacity:1.0; } .images_container input[type="chec ...

Creating a CSS Box Along the Border of Another Box: A Step-by-Step Guide

Is there a way to render a box on another box's border, similar to the example image here: Expected Output I attempted using flexbox to achieve this, but unfortunately wasn't successful in finding a solution. If you have any advice or suggestio ...

Creating a JavaScript anchor through a backend bean function

Is it crazy to want to create an anchor that can be called from a backing bean method using JavaScript? I need to do this for specific reasons, utilizing a commandButton with ajax set to false. I'm attempting the following approach: RequestContext.g ...

What is the best way to arrange these badges in a row?

I'm struggling to horizontally align these badges next to each other, as inline-block isn't working and they keep stacking vertically instead of side by side. How can I achieve the alignment shown in the image below? This is the desired appeara ...

Update the min-width for col-xl @media in Bootstrap 4 by modifying the HTML styles exclusively

Is there a way to set the min-width for .col-xl to 1600px in @media using only inline HTML styling, without having to modify any Less or Sass files? I simply want to keep Bootstrap's official CDN URLs for loading the library. ...

Mandate that users select from the available place autocomplete suggestions exclusively

I have integrated the "Places" Google API to enable address autocomplete in an input field on my website. However, since the service is limited to a specific area, I have implemented an autocomplete filter. The issue I'm facing is that users are stil ...

The HTML modal window is experiencing loading issues

I am attempting to implement a modal box that appears on click in an HTML document. The HTML code looks like this: <a href="#openModal">Open Modal</a> <div id="openModal" class="modalDialog"> </div> <a href="#openModal">O ...

What is the best way to select the element where a user has clicked using JavaScript?

Referencing a previous question on Stack Overflow, the goal is to track user clicks in a Firefox browser using JavaScript. The provided JavaScript code almost achieves this: var DocElements = document.getElementsByTagName('*');for(var i = 0; i & ...

Error encountered: Failure to construct URL for endpoint 'Bookdetails'. Have you overlooked supplying values for the parameter 'book_id'?

I have been troubleshooting this issue and reviewed similar threads, yet despite verifying all options, the problem persists. My code includes: application.py @app.route("/Booksearch/<int:book_id>", methods=["GET", "POST"]) def Bookdetails(book_id ...

uncovering the precise text match with the help of Beautifulsoup

I am looking to retrieve the precise matching value of text from HTML using Beautiful Soup. However, I am encountering some similar text along with my desired exact match. Here is my code: from bs4 import BeautifulSoup import urllib2enter code here url="h ...

Need to adjust the layout of PHP form

Snippet of code: echo "<form method ='post' action='NextFile.cgi'>"; echo "<table>"; echo "<tr><td>Date: </td></td> <input type='date' name='Date' value =".$record['Date& ...

Display elements on hover of thumbnails using CSS

I'm struggling with the logic of displaying images when hovering over corresponding thumbnails using only CSS. If necessary, I can do it in JavaScript. Here's my latest attempt. <div id='img-container' class='grd12'> ...

The responsiveness of Angular Material appears to be limited when tested in Chrome's debug mode for different devices

I have come across a peculiar issue. Within my HTML file, I have defined two attributes: Hide me on small devices Hide me on larger than small devices When I resize the window, the attributes work as intended. However, when I enter device debug mode ( ...

How to Make a Div Tag Fade Effect with JavaScript in an External File

*** New Team Member Notice *** I'm currently working on an assignment and trying to implement a simple fade effect on a box. While it seems like this should be straightforward, I'm encountering some obstacles. Currently, the button causes the bo ...

Custom background options for Wordpress developer

I have been exploring the WordPress codex to learn about incorporating custom background options, similar to this example $defaults = array( 'default-color' => '', 'default-image' => '&apo ...

Updating URL links with PHP and DOM manipulation

I am attempting to transform all the links within an HTML variable into random ones using PHP. However, I am encountering an issue that is preventing the links from being properly changed. Below is the code snippet I am working with: <?php $jobTempla ...

Next.js horizontal scrollbar appearing unexpectedly

As I work on my Next.js project, I've noticed an issue with unwanted horizontal scrollbars appearing on every subpage. These scrollbars allow scrolling about 30px horizontally, but only appear when the content extends beyond the viewport. I attempted ...