"Enhancing Grid Layouts with New Line Spacing in Bootstrap 4

I am currently utilizing the bootstrap 4 grid system.

Within my grid, there are 3 columns, each containing a key value pair. This forms a nested grid structure.

My concern arises when either the key or value exceeds one line, causing them to wrap onto a new line. I am looking for a solution to decrease the spacing between these lines.

I aim to have minimal or reduced space where I've highlighted with red lines.

https://i.sstatic.net/ESHQH.png

<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-4">
                <div class="row">
                    <div class="col-6 "><strong>Customer Name</strong></div>
                    <div class="col-6 ">smith</div>
                </div>
                <div class="row">
                    <div class="col-6 "><strong>Company</strong></div>
                    <div class="col-6 ">facebook</div>
                </div>
                <div class="row">
                    <div class="col-6 "><strong>header</strong></div>
                    <div class="col-6 ">value</div>
                </div>
            </div>
            <div class="col-4">
                <div class="row">
                    <div class="col-6 "><strong>Customer Name</strong></div>
                    <div class="col-6 ">smith abcdefg xyz</div>
                </div>
                <div class="row">
                    <div class="col-6 "><strong>Company</strong></div>
                    <div class="col-6 ">This can be very long company 
                                                            name</div>
                </div>
                <div class="row">
                    <div class="col-6 "><strong>header</strong></div>
                    <div class="col-6 ">value 11111</div>
                </div>
            </div>
            <div class="col-4">
                <div class="row">
                    <div class="col-6 "><strong>Customer Name</strong></div>
                    <div class="col-6 ">dave</div>
                </div>
                <div class="row">
                    <div class="col-6 "><strong>Company</strong></div>
                    <div class="col-6 ">Google</div>
                </div>
                <div class="row">
                    <div class="col-6 "><strong>header</strong></div>
                    <div class="col-6 ">value 11111</div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

A demonstration of this problem on Plunker:

https://plnkr.co/edit/TecPEUgj7YsgnrGVZytO?p=preview

Answer №1

The standard line-height in Bootstrap 4 is set to 1.5. To change this, you can apply custom CSS rules. In the following example, we have modified it globally.

body {
    line-height: 1;
}

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

DIV collapsing in reverse order from the bottom to the top

Looking for some help on how to create two links that, when clicked, will scroll a hidden <div> up to fill the full height of its parent container. I've been having trouble with the element using the full height of the <BODY> instead. ...

How do I prevent the React <div id="root"></div> from disrupting the layout of my design?

I am working on implementing a ReactJS template, but the footer keeps breaking and I need it to stay at the bottom. The main culprit is the <div id="root"></div>. Does anyone know how to fix this issue? https://i.sstatic.net/xNRKe.png import ...

Is there a way to override a LESS variable inside a mixin?

Currently, I am incorporating LESS into one of my projects and I have a requirement to establish different color schemes for various users. The project involves developing a portal where the color scheme should change based on the type of user logging in. ...

Ensure that the child div completely fills the entire width of its parent container,

My table contains another table within each row. I have implemented scroll overflow for the mobile view, but this causes the rows to not fill the available space and lose their background when scrolling. I have experimented with using width: fit-content a ...

Expanding text area size dynamically in Nuxt3 using Tailwind CSS

Is there a way to expand the chat input field as more lines are entered? I want the textarea height to automatically increase up to a maximum of 500px, and adjust the height of .chat-footer accordingly. Below is a snippet of my code. <div v-if="ac ...

Tips on making your debut post stand out: have the fifth post stretch across the entire width of the page, while arranging the

As a beginner in WordPress development, I am currently exploring the process of creating a theme from scratch without relying on plugins. One specific challenge I am facing is figuring out how to display the first post, fifth post, ninth post in full widt ...

Pressing the ENTER key does not submit the text box data in Rails/Bootstrap, but clicking the SUBMIT button does

I need assistance with my Rails 4 and Bootstrap 3 project. I have implemented an email address field on my page (localhost:3000) where users can enter their email and click the SUBMIT button to send it to the MongoDB database. However, pressing the ENTER k ...

Is there a way to arrange the cards in a row so they fill up the grid before moving on to the next row?

After retrieving data from a table in my database, I am displaying it on the screen as cards. However, the issue is that all the cards are displaying on the left side of the screen in a single column, rather than appearing in rows of 3 as desired. Below i ...

Converting CSS colors from RGBA to hexadecimal format: A step-by-step guide

Within my selenium code, I am faced with the challenge of verifying that the background color code is #192856. However, when obtaining the CSS property of the element, it returns the color in rgba format. How can I retrieve the values in hex format? quick ...

Bootstrap.js has the ability to utilize nested objects for organizing and

As I work on enhancing a Combobox class I developed to complement Bootstrap 4, I am aiming to align the Javascript with the existing Bootstrap code. During this process, I came across a snippet of code in bootstrap.js while studying the Modal component: ...

What is the best way to remove this .click function?

My goal is to create a switch function where clicking the "on" button changes its CSS, and if the user then clicks on the "off" button, the CSS returns to normal. I also need the switch to default to the "on" position, but my attempts so far have been unsu ...

Guide to deactivating scrolling on a specific element using jQuery

Can anyone provide a solution for disabling scroll on the window but still allowing scrolling within a text area? I attempted to use the following code, but it ended up disabling everything entirely: $('html, body').css({ overflow: 'hid ...

Tips for wrapping a div element around another div at the top left corner

I am working with a particular layout. <div class="comment"> <div class="leftpart"> </div> <div class="rightpart"> </div> </div> When viewing on a desktop, I maintain the original styling where each div is in its own s ...

Conceal the browser scrollbars

When I have two DIVs on my webpage that are larger than a browser window, it results in a horizontal scrollbar being displayed. How can I hide this browser scrollbar for the first DIV while still showing it for the second one? For example, if I have two ...

Unable to implement styles or classes in Vue.js when utilizing it in a loop

My code has a feature where item.fav starts as false, but changes to true when a button is clicked. I want the color of the icon to turn purple when item.fav is true, but it's not working as expected. <template> <v-container fluid> ...

Creating visually stunning full-width sections with graphic backgrounds using Bootstrap

Trying to bring a unique design concept to life, courtesy of my talented graphic designer. However, this sleek look is proving to be quite the challenge as I navigate through bootstrap implementation. We are focusing on a call to action section that perfe ...

Creating a pop-up confirmation message upon email submission through React and custom CSS styling

In my React project, I've created an email form and included the <div className="msg">Message has been sent</div> class. However, I only want this message to display when the message has successfully been sent (status: true). How ...

Customizing the appearance of map items in a React JS application

As a newcomer to reactjs, I am working with an array that looks like this: const mediumNames = ["TAMIL Medium", "ENGLISH MEDIUM"] Using the above code, I have created two cards: const [selectedMediumColor, setSelectedMediumColor] = useState('') ...

Creating a Customized Pop-up Box with Bootstrap CSS and JQuery/Java Integration

I have a filter box that appears when the filter icon is clicked, but it currently lacks Bootstrap styling. I am in the process of upgrading the website to Bootstrap3 HTML5. The current appearance of the filter icon is as follows: However, we want it to ...

Attempting to align a header and an unordered list side by side

I'm feeling a bit lost here and I've been doing my best to find a solution online, but no luck so far. What I need help with is getting my header element and unordered list to appear on the same line without losing their respective margins. ...