Creating organized layouts using Bootstrap for columns and rows

Struggling with formatting a modal as a novice front end coder. Apologies for the messy code!

Currently using bootstrap columns and a card, but having trouble getting the second row to move up close to the first row.

VIEW THE WEBSITE IMAGE HERE

I'm not sure what type of CSS element would be helpful in this situation. The elements I want to move up are labeled "thing" and "second row" in the code snippet.

Here's the relevant code:

<div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="test">
  <div class="modal-dialog modal-lg" style="overflow-y:auto">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">ORDER SUMMARY</h5>
        <button class="close" type="button" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <!-- start content -->
      <div class="container-fluid">
        <!-- FIRST ROW -->
        <!-- left column -->
        <div class="row" style="width: 100%">
            <div class="col-md-4" style = "width:0%; margin-right: 10%;"> ORDER DETAILS 
            <hr>  
             <!-- Order Number -->
                <div class="form-group" style = "margin-right: 10%;">
                  <label for="disabledTextInput">Disabled input</label>
                  <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input" style= "display: inline">
                </div>
          </div>
          <!-- right column -->
          <div class="col-md-4" style="width:100%; margin-right:20%; height:20rem;" id = "order-summary"> ORDER SUMMARY
            <div class="card" style="width:17rem; height:24rem">
              <div class="card-body" style="width:100%" id="item-summary">                

              </div>
            </div>
          </div>
        </div> 
        <!-- SECOND ROW -->
        <div class = "row">
          <div class="col-md-4 ml-auto" style = "width:100%; margin-right: 20%; position:fixed;"> things   
            <hr>  
             <!-- Order Number -->
                </div>
          </div> 
        </div> 


      </div>

CSS:

.row {
    display: flex;
}

.col {
    flex: 50%;
}

@media screen and (max-width: 600px) {
    .column {
        width: 100%;
    }
    .modal-content {
        width: 29rem;
        height: 38;
        margin: auto;
    }
}
label{
     font-weight: bold;
}

#create-order-modal {
    width: 750px !important;
    margin: auto !important;
}

.modal-content {
    width: 35rem;
    height: 35rem;
    margin: auto;
} 
.container-fluid{
    display:inline;
}

Looking for a quick fix but struggling to find one. The first row element seems too large, even though no specific CSS properties affect its size.

Answer â„–1

It's important to address the grid structure issues and utilize d-flex flex-clolumn and flex-grow-1 instead of manually setting element heights. To adjust the modal width, modify the width of modal-dialog.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet"/>
<div class="" tabindex="-1" role="dialog">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Order Summary</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="container-fluid h-100">
          <div class="row h-100">
            <div class="col d-flex flex-column">
              <div class="w-100">
                <p>ORDER DETAILS </p>
                <hr>  
                <!-- Order Number -->
                <div class="form-group" >
                  <label for="disabledTextInput">Disabled input</label>
                  <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
                </div>
              </div>
              <div class="mt-auto">
                <p>Things</p>
                <hr>  
              </div>
            </div>
            <div class="col d-flex flex-column">
              <p>Order Summary</p>
              <div class="card flex-grow-1" >
                <div class="card-body" id="item-summary">      
                  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos, corrupti asperiores nam possimus cum velit nemo sunt, atque voluptate natus, sed dolore praesentium nisi repellendus? Modi totam debitis facere voluptatem!</p>
                  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos, corrupti asperiores nam possimus cum velit nemo sunt, atque voluptate natus, sed dolore praesentium nisi repellendus? Modi totam debitis facere voluptatem!</p>
                </div>
              </div>
            </div> 
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>


https://codepen.io/anon/pen/QxzXoK

I've removed the modal from the outer div for better visibility. Remember to add it back in if you use this code in your project.


If you encounter any questions or issues with the code, feel free to leave a comment. I'll be happy to assist.

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

Switch the image source when hovering over a text menu

Currently, I have been using the following code to switch between images. However, what I actually want to do is change the image when hovering over the title link of the image. onmouseover="this.src='Images/img.png'" onmouseout="this.src=' ...

Getting 100% height on floated neighboring divs: Tips and tricks

​<div id='container'> <div class='left'></div> <div class='right'></div> <div class='clear'></div> </div>​​​​​​​​​​​​​​​​â ...

Creating a cell in HTML/CSS with wrapped data

Is there a way to properly wrap data in the table instead of getting a scroll bar when the template name is too long? I would like it to automatically go to the next line. <table class="selectablePreviousOrder dashboard"> <tr ng-class-odd=" ...

Tips for changing form field values using jQuery

Is there a way to use jQuery to retrieve the values of multiple checkboxes and insert them into a hidden form field? Here is how my checkboxes are structured: <form> <input type="checkbox" name="chicken" id="chicken" />Chicken <in ...

Is it possible to modify @page directive(CSS) values from the code-behind(C#) or JavaScript?

Using the @page directive, you can define the printer margins for a page separately from regular CSS margins: <style type="text/css" media="print"> @page { size: auto; /* auto is the current printer page size */ margin ...

Rearrange div elements following an ajax request based on a data attribute and applying the .animate method

I am dealing with a collection of div elements, each assigned a unique numeric id and data-position in sequential order (1 for the first in the list, 2 for the second, and so on). Upon making an ajax call using jQuery, the response is a JSON object that r ...

Two separate pieces of text converge within a single span

I am facing a challenge with alignment in a bootstrap <span> element. Specifically, I want to align the word "amount" to the left, and the "$" to the right, within the same label. I attempted to nest a <span> inside another <span> and app ...

How to position the footer at the bottom of the page in Bootstrap 4

I am currently utilizing Bootstrap 4 for my project. My template structure is set up like this: <div id="app"> <div id="content"> <nav id="content-header"> ...code here... </nav> <main id="content-main"> ...

Turned off jquery on a specific div in order to resolve compatibility problems with Vue.js

Currently, I am working on a Drupal project which includes JQuery in all pages. We have recently introduced Vue.js for creating dynamic components directly in the HTML pages (not for building a single-page application). However, we are facing an issue whe ...

How to create horizontal spacing between divs using Bootstrap 3

I am struggling to create a small horizontal space between the "Away Team" and "Baseball Field" divs in my code. I have tried adjusting padding, margins, and even adding decimal column offsets without any success. The desired spacing effect can be seen in ...

Avoid automatically scrolling to the top of the page when a link is clicked

Within my ASP.NET MVC 5 application, there exists a partial view containing the following code: <a href="#" onclick="resendCode()" class="btn btn-link btn-sm">Resend</a> Additionally, on the View, the resendCode() function is present: funct ...

Discovering problems within inline lists using Bootstrap in combination with a fiddle and a snippet of code

Just starting out in the world of coding and I'm encountering a bootstrap issue related to list-inline not displaying properly. I've attempted to troubleshoot this problem using Sublime Text and JSFiddle, but unfortunately, I haven't been a ...

Printing style in CSS

Everything looks good on my webpage. For printing, my CSS adjusts the layout and section sizes. Unfortunately, there is an issue with the print layout - there is a one-inch margin on the left side causing two elements to go off the page on the right. I ...

Navigation website with a twist

My design features a main navigation that is rotated 90 degrees, while the sub-menu remains horizontally aligned. <div id="nav"> <ul> <li><a href="#">Woonaccessoires</a></li> ...

Experiencing issues with exporting <SVG> file due to corruption

I received some downvotes on my previous post, and I'm not sure why. My question was clear, and I provided a lot of information. Let's give it another shot. My issue is with exporting <SVG> files from an HTML document. When I try to open t ...

The submission feature for the textarea in Javascript is not functioning properly

As someone who is new to frontend development, I am currently facing a challenge with debugging JavaScript code that involves making changes to the content of a textarea. Despite my efforts to debug using the browser console, I have yet to identify why it ...

Could the absence of an external style sheet for CSS be hindering the execution of my code?

A generous Stack Overflow user provided me with the code you see here and their JSFiddle can be accessed at http://jsfiddle.net/f18513hw/. The code functions properly in JSFiddle. I copied and pasted the code into my Textpad, saved it in my htdocs folder o ...

Tips for reducing code length in jQuery

Here's an interesting question that I've been pondering. Is there a more efficient way to optimize and condense code like the one below? Could it be achieved using functions or loops instead of having lengthy jQuery code? var panels = ["panel1", ...

Discover how to access the translations of a specific key in a chosen language by utilizing the angular $translate functionality

How can I retrieve a specific language translation using angular's $translate function within a controller? The $translate.instant(KEY) method returns the translation of the specified key based on the currently selected language. What I am looking for ...

Forms for uploading and submitting multiple files

On my single page, I have several file upload forms that are generated in a loop. The issue is that the first file upload control works fine, but the others do not. <div> <form action="/docs/1046/UploadDocument?Id=1046&amp;propertyTypeId ...