Styling the borders of Bootstrap divs with precise row and column positioning

I have recently created a jsFiddle that showcases my design. I am looking to place a border between the row lines while maintaining the background color displayed in the jsFiddle. How can I achieve extending the column border line?

Here is the HTML markup:

<div class="container top5">
    <div class="row">
        <div class="col-md-12 col-xs-12">
            <div class="row">
                <div class="col-md-3 col-xs-3 inner">
                   <div><b>Type</b></div>
                </div>
                <div class="col-md-3 col-xs-3 inner">
                   <div class=""><b>SMS</b></div>
                </div>
                <div class="col-md-3 col-xs-3 inner">
                   <div class=""><b>Email</b></div>
                </div>
                <div class="col-md-3 col-xs-3 inner-end">
                    <div class=""><b>Business Unit</b></div>
                </div>
            </div>
        </div>
        <div class="col-md-12 col-xs-12">
            <div class="row border-between">
                <div class="col-md-3 col-xs-3 inner">
                    <span>Another testing text</span>
                </div>
                <div class="col-md-3 col-xs-3 inner">
                    <span> test</span>
                </div>
                <div class="col-md-3 col-xs-3 inner">
                    <span>Random text</span>
                </div>
                <div class="col-md-3 col-xs-3 inner-end">
                    <span>Random text</span>
                </div>
            </div>
        </div>
    </div>
</div>

And here is the corresponding CSS:

.top5 {
    margin-top: 50px;
}

.row {
    border: 1px solid;
}

.row + .row {
    border-top:0 ;
}

You can view the live demo and code on my Fiddle - here.

Answer №1

To enhance the layout of your cells, consider utilizing padding instead of margin and implementing flexbox to align the div cells efficiently.

.top5 {
  margin-top: 50px;
}

.row {
  border: 1px solid;
}

.row + .row {
  border-top: 0;
}

.flx {
  display: flex;
}

.inner {
  background: aliceblue;
  border-right: 1px solid blue;
  padding: 10px 15px;
}

.inner-end {
  background: aliceblue;
  padding: 10px 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container top5">
  <div class="row">
    <div class="col-md-12 col-xs-12">
      <div class="row">
        <div class="flx">


          <div class="col-md-3 col-xs-3 inner">
            <div><b>Type</b></div>
          </div>
          <div class="col-md-3 col-xs-3 inner">
            <div class=""><b>SMS</b></div>
          </div>
          <div class="col-md-3 col-xs-3 inner">
            <div class=""><b>Email</b></div>
          </div>
          <div class="col-md-3 col-xs-3 inner-end">
            <div class=""><b>Business Unit</b></div>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-12 col-xs-12">
      <div class="row border-between">
        <div class="flx">
          <div class="col-md-3 col-xs-3 inner">
            <span>Another tesing text</span>
            <div>1</div>
            <div>2</div>
          </div>
          <div class="col-md-3 col-xs-3 inner">
            <span> test</span>
          </div>
          <div class="col-md-3 col-xs-3 inner">
            <span>Random text</span>
          </div>
          <div class="col-md-3 col-xs-3 inner-end">
            <span>Random text</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

View JSFIDDLE Example

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

Text Module of the Divi theme

Issue Resolved (After noticing that Divi was adding padding twice to <ul>'s in their footer and Text Module, I created a new class to remove the padding-bottom from the sub-list item.) In a Divi text module, I created an unordered list with a s ...

Discovering the pressed submit button in Node.js: A beginner's guide

How can the controller or admin determine which submit button was pressed in a form like this? <form method="POST"> <input type="submit" value="Add Admin" name="addAdmin"> <input t ...

"Trouble with Animations: Animate.css not functioning

I've been attempting to implement the animate.css plugin into my code, but for some reason, I just can't seem to get it working properly. Can anyone point out where I may have made a mistake? Here is the code I am using: <html> <head& ...

The mousedown functionality does not seem to be functioning properly on elements added dynamically

How can we trigger the mousedown event on dynamically appended elements? $(function() { var isMouseDown = false, isHighlighted; $("#myTable tr").mousedown(function() { isMouseDown = true; $(this).toggleClass("highlighted"); isH ...

Are the JQuery appended elements exceeding the width of the parent div?

I have an HTML div that is styled using the Bootstrap class span9. <div class="span9"> <div id = "selectedtags" class="well"> </div> <button class="btn" type="button" id="delegatecontent">Generate report</button&g ...

Issues with vue.js navigation menu functionality when incorporating bootstrap libraries

I've been trying to figure out how to incorporate Bootstrap with Vue.js, but I'm having trouble with getting the menu click to navigate to different tabs. Only the content from the first tab is showing all the time. <!doctype html> <htm ...

Is it possible to save an HTML div as an image file?

Is there a way to save the output of an HTML div as an image using rmarkdown or R, possibly with a package like htmltools? For example: <div class="w3-container w3-teal"> <h1>My Header</h1> </div> ...

Is there a way to utilize solely Javascript in order to crop an image?

Is there a way to crop an image using plain JavaScript? I need a function that can take an image with specific width, height, offsetX, and offsetY and create a new image of the specified portion. I'm not very knowledgeable about HTML5 canvas and simi ...

What are some ways to make source code more visually appealing on an HTML/JSP page as it is being

I've recently created a webpage with some Java source code, neatly organized within blocks. However, I'm looking to enhance its appearance so it truly looks like Java code. Take a look at my page's code here for reference: Are there any onl ...

Divide data into an HTML table and merge it with header information

My HTML form contains an interactive HTML table where users can add/delete rows. I am sending this data to a Google Sheet and need to store the row information with corresponding header details. Each time a user submits the form, a new row is added to the ...

How do I resolve the issue of Python doubling (" ") to ("" "")?

Here is an example of the code I am using without the website included. from bs4 import BeautifulSoup import requests import csv import random as rd source = requests.get('http://example.com').text file = open('C:/xampp/htdocs/new-site/text ...

The PHP code to include the head section with a link to the CSS is not functioning properly

I've recently dabbled in PHP and encountered my first issue that I can't seem to resolve. My goal is to have my index.php file, with the following code in the head section: <head> <?php require 'php/main/head.html'; ?> & ...

The issue with Bootstrap 4 toggle not correctly hiding the following div

I am trying to hide one div when the other div is displayed using Bootstrap code. However, both divs are currently displaying and my code is not working as intended. If anyone can provide assistance, it would be greatly appreciated. <link rel="st ...

Trouble with formatting a HTML form

I have been working on dynamically creating HTML forms using a function called makeInput(). However, I am facing an issue where the text input boxes are appearing next to each other when I click the "Add Course" button, instead of one per line. Below is ...

Repeating linear gradients in the background

After creating a linear-gradient background animation in CSS for my to-do list, I encountered an issue. As I added more items to the list, the website became scrollable and the background started repeating, which made it look unappealing. I attempted to s ...

Utilizing CSS-in-JS to eliminate arrow buttons from a TextField

I'm currently developing a webpage using React and Material-UI. One of the components I have is a TextField element, and I need to remove the arrow buttons that typically appear on number input fields. If I were utilizing CSS, I could easily achieve t ...

When using WYSIWYG editors, be on the lookout for empty paragraphs and incorrect code in CSS, JavaScript, and

I am currently in the process of redesigning a website for a client. The site is already built using Joomla 1.7, but I am facing an issue with the articles section that was created by the client using a WYSIWYG editor. The problem lies in the messy code st ...

When the field is clicked into for the second time, the month and year picker values will update

I recently implemented a month and year date picker code I found on a website. While I was able to customize the date format (mm/dd/yy) and successfully select values, I encountered an issue where the selected date changes drastically when clicking away fr ...

Changing the color of HTML text based on a variable in Vue JS can be achieved by altering the CSS styles dynamically

I have developed a website that shows values with a set threshold. I now want to change the color of the values when they exceed the threshold, but I am unsure of how to proceed. I want to display consultation.indicateurs.TRS in red when it exceeds the va ...

Achieve full width with flexbox column wrap while minimizing the height

How can I arrange elements in columns within a container with a fixed width and variable height, when the number of elements is unknown? My challenge is that I do not know the maximum width of the child elements, preventing me from setting specific column ...