How do I ensure that the columns in bootstrap 3.3.7 stack seamlessly without any gaps in mobile view?

I'm encountering an issue with Bootstrap- when viewing on mobile, the columns are stacking together with gaps between them. How can I eliminate these gaps so that they display in a single column?

Here is my code:

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div class="container">

  <div class="row">

    <div class="col-sm-4 col-sm-offset-3 white no-gutters">
      <h3>Weather for LA</h3>
    </div>
  </div>

  <div class="row equal">
    <div class="col-sm-2 col-sm-offset-3 white col-equal no-gutters">
      <img src="https://www.w3schools.com/howto/img_fjords.jpg">
      <h3>7 C</h3>
    </div>
    <div class="col-sm-2 col-equal white no-gutters">
      <h4>01-14-2018</h4>
      <table class="table table-striped table-sm">
        <tr>
          <td>Wind</td>
          <td>
            <?php echo $wind.'m/s'; ?>
          </td>
        </tr>
        <tr>
          <td>Clouds</td>
          <td>
            <?php echo $cloudiness;?>
          </td>
        </tr>
        <tr>
          <td>Pressure</td>
          <td>
            <?php echo $pressure.' '.'hpa';?>
          </td>
        </tr>
        <tr>
          <td>Humidity</td>
          <td>
            <?php echo $humidity.'%';?>
          </td>
        </tr>
      </table>
    </div>

  </div>

</div>

Answer №1

Avoid using offset in this situation. It's better to set the position:absolute for the table, which will center it on the image. Assuming that's your desired outcome.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div class="container">

  <div class="row">

    <div class="col-xs-12">
      <h3>Weather for LA</h3>
    </div>
  </div>

  <div class="row equal">
    <div class="col-xs-12">
      <img src="https://beebom-redkapmedia.netdna-ssl.com/wp-content/uploads/2016/01/Reverse-Image-Search-Engines-Apps-And-Its-Uses-2016.jpg" style="width:100%;">
      <h3>7 C</h3>
    </div>
    <div class="col-xs-12" style="position:absolute; padding:5% 20%;">
      <h4> 01-14-2018</h4>
      <table class="table table-striped table-sm">
        <tr>
          <td>Wind</td>
          <td>
            7 mph
          </td>
        </tr>
        <tr>
          <td>Clouds</td>
          <td>
            Light
          </td>
        </tr>
        <tr>
          <td>Pressure</td>
          <td>
            4 Pa
          </td>
        </tr>
        <tr>
          <td>Humidity</td>
          <td>
            12
          </td>
        </tr>
      </table>
    </div>

  </div>

</div>

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

Arrange your grid system with Bootstrap Vue

There is a dataset retrieved from an API, and each item will be displayed within a div using a v-for loop. The desired layout for the grid of divs is as follows: [-- item 1 --][-- item-2 --] [-- item 3 --][-- item-4 --] [-- item 5 --][-- item-6 --] [-- ite ...

Set the text to be centered and aligned to the left margin in an HTML document

After creating a bullet-point list in HTML, I centered the text and bullet points. However, when I center the text, the bullet points become staggered. Is there a way to keep the text in a straight line on the left while still centering it? https://i.ssta ...

Utilize Bootstrap to deactivate the time picker feature

I recently downloaded an admin template that includes a datetimepicker. However, I only need the date picker and am struggling to disable the time picker. Can anyone help me fix this issue? I will provide my class file, HTML code, and a snapshot of the tim ...

Seamlessly transition between various states within a React component for a fluid user experience

I'm currently working on a simple component structured like this: var component = React.createClass({ render: function(){ if (this.props.isCollapsed){ return this.renderCollapsed(); } return this.renderActive() }, ren ...

Submission form triggered with incomplete or inaccurate data

I am struggling with preventing my form from submitting if the user has not entered information or has entered it incorrectly. Despite having code in my JavaScript to handle this validation, when I click the submit button, the form still submits. I tried u ...

Tips for utilizing CSS perspective to align a div so it seamlessly fits within an SVG laptop display

Confusion may arise from the question at hand. My goal is to utilize CSS to absolutely position a div with perspective in a way that resembles it being inside the laptop screen I created with an SVG. I am under the impression that achieving this effect is ...

Disregard the CSS rule for maximum width set on the

I have a section on my website that is restricted to a specific width like this: HTML <div class="section"> // content goes here </div> CSS .section { max-width: 1300px; } Now, I have another div that I want to expand beyond the maximum ...

How can I show a Spinner component overlay in a TextField, replacing the usual iconProps rendering the icon in Fluent UI?

I am looking for a way to conditionally display the Spinner component in the exact location where an icon would normally appear if passed to iconProps in TextField. I have managed to implement conditional rendering of the icon and spinner, but incorporat ...

Trouble with Cufon loading and failing to display properly

Testing scenario: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script type="text/javascript" src="/cufon.js"></script> <script type="text/javascript" src="/font.font.js"></script> </head> &l ...

Implementing CSS styles on iframe content in React

Is there a way to style the content loaded by an iframe in a React app using CSS? I'm facing an issue with loading external content into my app, as the styles are outdated and I want to customize them. See Example Below: (Please note that the src co ...

Show, in percentage, the width of the box when set as a table-cell

I'm struggling with this CSS code: section.products { display: table; width: 100%; table-layout: fixed; } section.products > article { display: table-cell; width: 33%; } The issue I'm facing is that the width is not ...

Display an element only when it is contained within another element

I've been attempting to develop a container with two components that slide in when clicked, swapping one for the other, but I want them to only be visible within the container. Here's my not-so-great code, please help me out. HTML <input id ...

Stop all animations in JS and CSS

Looking for a way to halt all CSS and JavaScript animations, including canvas and webGL effects, on a specific webpage. Some animations can cause slow performance on certain browsers like Opera and Firefox, so I'm seeking a code snippet or guidance o ...

Ways to condense a text by using dots in the middle portion of it

How can I dynamically shorten the text within a container that varies in width? The goal is to replace the strings between the first and last words with dots so that it fits within the container. For example, Sydney - ... - Quito. It should only replace wh ...

Is there a way to adjust the opacity of a background image within a div?

I have a lineup of elements which I showcase in a grid format, here's how it appears: https://i.stack.imgur.com/JLCei.png Each element represents a part. The small pictures are essentially background-images that I dynamically set within my html. Up ...

What is the best way to ensure that my CSS3 columns break only at line breaks?

Currently, I am developing a webpage that involves multiple fieldsets within a single form page along with the utilization of CSS3 columns. However, an issue arises where the columns wrap in a manner that causes part of a fieldset to be stranded when tran ...

Making the browser refresh the CSS automatically once it has been modified

When updating a CSS file on the server, it's common for many client browsers to continue loading pages using the old cached CSS file for an extended period. After exploring various posts and piecing together different ideas, I have devised what appea ...

Adjust the line height appropriately to prevent any text from being cut off

I need a solution for displaying multiline text in a div with overflow:hidden without clipping the text. Here's an example of clipped text: I want to achieve this using only Pure CSS, without relying on Javascript. If my div has a fixed height, I c ...

How to position an image in a carousel using Bootstrap 3 CSS

I am currently customizing a bootstrap carousel example by adjusting the CSS code to ensure that the center of larger images aligns perfectly in the middle of the carousel. Here is the code snippet I am working with: .carousel-inner > .item > img { ...

Modify the CSS based on the number of elements present in the Meteor collection

Currently, I am in the process of developing an application that will enable users to save equations and access them from a homepage. The goal is to have a button labeled "Equation" appear on this homepage. However, I am faced with the challenge of styling ...