Bootstrap 4 Alpha Grid does not support aligning two tables side by side

When working with Bootstrap 4, I am aware that the .col-xs classes have been removed. Instead of using .col, I have tested it on Bootstrap 3.5 which is currently being utilized.


        <div class="col-xs-4">
             Table content for left side here
        </div>
        <div class="col-xs-8">
             Table content for right side here
        </div>
    

It worked perfectly as shown here.

However, there are some differences in how it behaves on Bootstrap 4 Alpha:


        <div class="col-2">
            <h2 class="sub-header">Test Area</h2>
            <div class="table-responsive">
                <table class="table table-striped">
                    <tbody>
                        <tr>
                            <td class="col-md-1">Test</td>
                        </tr>
                        <tr>
                            <td class="col-md-1">Test 2</td>
                        </tr>
                        <tr>
                            <td class="col-md-1">Test 3</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col-10">
            <h2 class="sub-header">Ticket Number</h2>
            <div class="table-responsive">
                <table class="table table-striped">
                    <tbody>
                        <tr>
                            <td class="col-md-1">1,001</td>
                            <td class="col-md-2">1,002</td>
                            <td class="col-md-3">1,003</td>
                        </tr>
                        <tr>
                            <td class="col-md-1">1,004</td>
                            <td class="col-md-2">1,005</td>
                            <td class="col-md-3">1,006</td>
                        </tr>
                        <tr>
                            <td class="col-md-1">1,002</td>
                            <td class="col-md-2">1,021</td>
                            <td class="col-md-3">1,023</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    

You can view the results here.

Even though I want the tables to be displayed side by side, they appear differently. Am I overlooking something?

Answer №1

To properly layout columns in Bootstrap 4, you need to use a row wrapper because Bootstrap four uses flexbox instead of floats. This wrapping will help organize the columns correctly.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap-grid.css" rel="stylesheet"/>
<div class="row">
  <div class="col-2">
    <h2 class="sub-header">Test Arear</h2>
    <div class="table-responsive">
      <table class="table table-striped">
        <tbody>
          <tr>
            <td class="col-md-1">Test</td>
          </tr>
          <tr>
            <td class="col-md-1">Test 2</td>
          </tr>
          <tr>
            <td class="col-md-1">Test 3</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
  <div class="col-10">
    <h2 class="sub-header">Ticket Number</h2>
    <div class="table-responsive">
      <table class="table table-striped">
        <tbody>
          <tr>
            <td class="col-md-1">1,001</td>
            <td class="col-md-2">1,002</td>
            <td class="col-md-3">1,003</td>
          </tr>
          <tr>
            <td class="col-md-1">1,004</td>
            <td class="col-md-2">1,005</td>
            <td class="col-md-3">1,006</td>
          </tr>
          <tr>
            <td class="col-md-1">1,002</td>
            <td class="col-md-2">1,021</td>
            <td class="col-md-3">1,023</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>

Check out this example on Bootply

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

CSS Dropdown Menu Malfunctioning

I recently created a navigation bar using some online tutorials, and everything seems to be working fine except for the drop-down menu. I've been struggling with it for hours and can't seem to find a solution. Any help would be greatly appreciate ...

What is the method for adjusting the success button's color using SASS?

My current theme's success button is green, but I want to change it to yellow. How can I achieve this? In the _variables.scss file, the following lines are present: $btn-success-color: $btn-default-color !default; $btn-success-bg: ...

Tips for eliminating stuttering when fixing the position of an element with JavaScript

I am currently facing an issue with a webpage I created where the text freezes when scrolled down to the last paragraph, while the images continue to scroll. Although my implementation is functional, there is noticeable jankiness when using the mouse wheel ...

An unexpected error has occurred: Module not found - ui.bootstrap.alert in line 17 of angular.min.js

Check out this snippet of HTML and AngularJS code <html ng-app="myApp"> <head> <title>My Angular App</title> <link href="Styles/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="Scripts/an ...

Ways to stop Bootstrap 4 dropdown from appearing when clicking on an input field?

Here is a straightforward bootstrap dropdown menu example, but with a twist - the toggle element is a text input. Instead of showing the dropdown on click event, I want it to appear when the user inputs something so I can dynamically populate the menu base ...

Creating word spacing in CSS paired with a navigation menu using Dreamweaver

As a beginner in Dreamweaver, CSS, and HTML, I may have made some mistakes or overlooked simple solutions. I am currently struggling with how to separate words in my navigation menu, as they always appear centered. Despite trying adjustments like "word-spa ...

two adjacent DIV elements with matching heights

Currently, I am in the process of developing an internal web page with a wrapper DIV structure based on recommendations from an online tutorial. Within this wrapper, there are different sections including a header, mainnav, content, sidenav, and footer. Th ...

Assessing the value of a variable or expression embedded within a string in Sass

Creating a mixin to set a div to transparent requires special attention to evaluate a variable in a string. The -ms-filter line must be quoted and should include the result of a calculation ($amount * 100). How can I successfully incorporate this into my ...

What is the best way to cut out a portion of a div using CSS?

I have a scaled down version of my project, but it's not quite what I need. I would like the green div to have some transparency so that the content behind both divs is visible (there is none in the example, but there is in my actual project). However ...

Image broken on default bootstrap navbar

On my computer where I am developing a Ruby on Rails app, I have a relative link to an image. To customize the style, I am using Bootstrap and have used their code to source the image for the top left brand placement. You can view the Bootstrap link here. ...

Having trouble getting the align-items-end property in Bootstrap 4 to function

After dedicating almost two full weeks to this project, I'm still struggling to achieve the desired outcome. I suspect that the issue may lie in the depth of the rows and columns I'm working with, but I'm open to any external perspectives or ...

Attempting to include a standard VAT rate of 5% on the invoice

/* The code format is correct and I don't see any issues on my end, I hope it works well for you. */ I need assistance in adding a fixed VAT (tax) rate of 5%. The tax amount should be displayed on the row, while the total tax should reflect the sum o ...

Tips for maintaining the position of items with absolute positioning while resizing:

Hello, I am seeking help with an issue in my code. My problem is as follows: I have two items and one frame. The frame has a position relative to the two items (children) which have positions set to absolute. Ideally, these children should always remain ...

the live binding feature fails to function properly once an append operation is executed

Could someone please explain to me why adding an even number of squares causes the bind event to stop working? $("#add").click(function(){ $("#container").append("<div class=\"square\">xxxxxx</div> ").bind("click",function(e) { ...

Tips for structuring a JSON array of objects with the help of jQuery and Bootstrap

Currently, I am in the process of developing an online shopping application using Struts 2, MySQL, jQuery, JSP, Bootstrap, Gson, and Tomcat. In my Java entity, I have a class named Product, which is linked to a controller action that returns a JSON array ...

Run a Javascript function two seconds after initiating

My goal is to implement a delay in JavaScript using either setInterval or setTimeout, but I am facing an issue where the primary element is getting removed. Code that works fine without Javascript delay: const selectAllWithAttributeAdStatus = document. ...

Within the flask framework, I am experiencing an issue where paragraphs are being overwritten. My goal is to find a

Snippet of HTML: <div class="split left" > <div class="centered"> <div class="container"> <p>Hi!</p> </div> <div class="darker"> <p>{{message}}& ...

What makes the element[class=noquotes] function so effective?

According to the MDN attribute selector in CSS, it has the following syntax: div[attr="actualValue"] For example: <div class="test"></div> div[class="test"] However, I have observed that the quotes around the test are not necessary as show ...

What is the best method for adding space between elements in flexbox layout?

I am struggling to align the child flexboxes within my parent flexbox in a single row, both vertically and horizontally centered. I want to add space between them using the gap property in CSS, but the images and embedded videos inside these child flexboxe ...

What steps should I take to create a collapsible Bootstrap navbar?

I'm attempting to recreate the scrolling functionality seen here: It seems like they might be using a customized Bootstrap Navbar, so I've taken one from here: and tailored it to my needs. How can I achieve the effect where the navigation bar ...