Tips for creating a responsive container for mobile and smaller devices using Bootstrap 3

Apologies in advance for the lengthy post, but I welcome any suggestions and ideas. Thank you!

I'm facing an issue with my layout breaking when the screen size is below 1200px (images and text drop down). I don't mind if they stack vertically on smaller browsers, as long as each item is correctly positioned under the corresponding heading.

Heading 1
8:00am
Lorem ispum
Lorem ispum
Lorem ispum

8:30am
Lorem ispum
Lorem ispum
Lorem ispum

Heading 2
9:00am
Lorem ispum
Lorem ispum
Lorem isum

And so forth...

My question is, what would be the optimal way to make this layout work effectively on mobile devices and smaller screens? I've tried using Bootstrap's img-responsive class, but I haven't seen a noticeable change in the image - it's possible that I'm not using it correctly. I expected it to resize the image.

Additionally, in the provided screenshot, there are 3 headings with 4 associated times. What is the best approach to align each heading with its respective time slot (Heading 1 having two times)? Currently, the associated times of "Heading 2" and "Heading 3" seem slightly off to the left. I attempted adding padding/margin to adjust this, but it didn't resolve the issue.

<div class='tours-information'>
    <div class='container'>
      <div class='row'>
        <div class='col-md-9'>
          <div id='schedule'>
            <h2>Schedule</h2>
              <!--- wrapper for each day -->
              <div class='clearfix'>
                <h3 class='rounded-heading'>Main heading</h3>
              </div>
                  <div class="media">
                    <h5 class="media-heading pull-left ">Heading 1</h5>
                    <img class="media-object pull-left img-responsive" src="img/long_blue_arrow.png" alt="..." />
                    <h5 class="media-heading pull-left">Heading 2</h5>
                    <img class="media-object pull-left img-responsive" src="img/short_blue_arrow.png" alt="..." />
                    <h5 class="media-heading pull-left">Heading 3</h5>
                 </div>

                 <div class='schedule-location'>
                  <div class='col-md-3'>
                    <h4>8:00am</h4>
                    <div class='schedule-address'>
                      <address>
                      Lorem ispum<br>
                      Lorem ispum<br>
                      <span class='schedule-location-name'>(Lorem ispum)</span>
                    </address>
                   </div>
                 </div>
               </div>

                <div class='schedule-location'>
                  <div class='col-md-3'>
                    <h4>8:30am</h4>
                    <div class='schedule-address'>
                      <address>
                      Lorem ispum<br>
                      Lorem ispum<br>
                      <span class='schedule-location-name'>(Lorem ispum)</span>
                    </address>
                   </div>
                 </div>
               </div>

                <div class='schedule-location'>
                  <div class='col-md-3'>
                    <h4>9:00am</h4>
                    <div class='schedule-address'>
                      <address>
                      Lorem ispum<br>
                      Lorem ispum<br>
                      <span class='schedule-location-name'>(Lorem ispum)</span>
                    </address>
                   </div>
                 </div>
               </div>

                <div class='schedule-location'>
                  <div class='col-md-3'>
                    <h4>10:00am</h4>
                    <div class='schedule-address'>
                      <address>
                      Lorem ispum<br>
                      Lorem ispum<br>
                      <span class='schedule-location-name'>(Lorem ispum)</span>
                    </address>
                   </div>
                 </div>
               </div>

#schedule {
  background-color: #fff;
  float: left;
  padding: 2px 25px 25px;
}

#schedule img {
  margin-top: 3px;
}

#schedule h2 {
  font-size: 35px;
  margin-bottom: 0px;
}

#schedule h3 {
  font-size: 28px;
}

#schedule h4 {
  font-size: 30px;
}

.rounded-heading {
    display:block;
    clear:right;
    float:left;
    padding: 1.5%;
    width:auto;
    height:auto;
    border-radius:10%;
    -moz-border-radius:10%;
    -webkit-border-radius:10%;
    -khtml-border-radius: 10%;
    background:#eee;
    text-align:center;
}

Answer №1

Utilizing the row class is crucial for creating a responsive layout. Take a look at the Bootstrap documentation here http://getbootstrap.com/css/#grid and remember that you have the option to combine classes in order to customize your layout, especially on smaller devices.

For example, using

<div class="col-sm-6 col-lg-3">
will adjust your layout from 4 columns to 2 columns on devices with a width of ≥768px, and then to a single column on phones.

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

Utilizing Ajax and FileReader to Save Data in Segments

I am currently developing a file uploader that will send data to a remote server in chunks using a third-party API. The API offers a WriteFileChunk() method with three parameters: the target file path, start position (Int64), and byte data. When FileReade ...

How can I send identical posts to multiple servers and link specific data to each post?

I am attempting to send a post request to multiple servers using jQuery, potentially facing issues with CORS. I have an array containing the jQuery posts and I register the same callback function for each individual one like this: var requestUrls = getReq ...

Issue with Responsive Font Size functionality in Tailwind and ReactJS not functioning as expected

I'm really struggling with this issue. I grasp the concept of mobile-first design and have successfully made my website's layout responsive. However, I'm having trouble getting the font size to change when applying breakpoints as the screen ...

The function $.getJSON() seems to be non-responsive

I've been struggling to solve this issue for quite some time now. The users.json file that I am using can be found in the "JSON" folder alongside the other files. The alert("Before") is functioning properly, but I'm facing difficulty with getting ...

Using AngularJS controllers: How can one trigger a controller from within a different controller?

Within my script, I have a list controller defined as follows: define([ 'jquery', 'app' ], function ($,app) { app.controller("ListContacts", function($scope,$route,$http){ $http({ method: 'GET&apo ...

Completion of the form within the Bootstrap popover

I have a feature where dynamically created rows contain an "add" button. When the user clicks on the add button, a form is loaded into a Bootstrap popover. See FIDDLE DEMO My issue is: Why isn't this code being triggered? I am trying to validate ...

Laravel Troubles: The Predicament of Handling Ajax Requests - Error 400

Here is the JavaScript code snippet: $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' } }); $.ajax({ type : 'POST', url: 'test', data: data, success: ... }); An issue where a 400 error occurs h ...

The output is: [object of type HTMLSpanElement]

<form> <table> <tr> <td>Distance:</td> <td><input type="number" id="distance" onKeyUp="calculate();">m</td> </tr> <tr> <td>Time:</td> ...

Managing the order of rows in Bootstrap specifically for mobile devices

Take a look at this simple HTML snippet on this fiddle that illustrates a specific layout on wide desktop screens: Here is the code responsible for rendering the above layout: <div class="container"> <div class="row"> <div class="col-md-4" ...

Learn how to simultaneously play two audio files using the same identifier in JavaScript

I'm facing an issue with two audio files that have a progress bar and both have the same ID: <audio id="player" src="<?=base_url('mp3/'.$rec->file)?>"></audio> </p> ...

A guide to retrieving a JSON Object using Python within the Flask Framework

How do I extract a JSON Object using Python within the Flask Framework? Check out this snippet of code ` var hotel=$( "#listHotel option:selected" ).val(); if(hotel!="select") { $.ajax({ url: '/getHot ...

Multiplication and Division with Unit-ed Values in CSS calc() Function

Can you perform multiplication or division with unit-based values using calc() (such as 100%, 5px, etc)? For instance, I wanted to try something like this: width: calc(100% * (.7 - 120px / 100%)); Expecting it to result in something similar to (if 100% ...

What is the method for conducting rspec tests on HTML attributes?

Using Ruby, I have generated the following HTML: <%= link_to "change", "http://gravatar.com/emails" %> which creates this link: <a href="http://gravatar.com/emails">change</a> However, I want to make sure that the link opens in a new ...

Utilizing Bootstrap Modal to Display PHP Data Dynamically

Modals always pose a challenge for me, especially when I'm trying to work with someone else's code that has a unique take on modals that I really appreciate (if only I can make it function correctly). The issue arises when the modal is supposed ...

I am having trouble with node.js express not recognizing the path to my CSS files

My objective is to load information onto an HTML page using Node.js and Express. The issue I am facing is that when I try to open the main page (which displays all the books from the database), everything works smoothly - the CSS and JS files are located ...

Tips for creating a form with recurring elements efficiently

Currently struggling to summarize the issue at hand with a simple title, so here's the detailed explanation: Imagine I'm inputting information for multiple contacts, and there are various fields involved: Name of the contact Method of Contact ...

Halted program - Repeating process on extensive array

With over 120,000 files to read and add to my database, I came across a challenge. After using PHP to list the main directory content and sending it as JSON to my JavaScript, an error message popped up when trying to display the result: Warning: Unrespons ...

Bottom div refuses to adhere to the bottom of the page

I need help with creating a footer div that sticks to the bottom, left, and right of the page. The current footer doesn't extend all the way down and left. How can I resolve this without using "position: fixed;"? Below is the code snippet (I have rep ...

What is the best way to create a JQuery function that fills a div based on the selected option from an HTML select

Check out this simple JavaScript function below. <html> <head> <script> $(document).ready(function() { $.get('getImage.php', function(data) { $('#imageSelector').html("<select>" + d ...

interactive navigation menu with countdown feature

Looking to create an HTML/jQuery dropdown menu, but encountering a problem. The goal is for the div to slide down when the mouse hovers over the "games" navigation button and only disappear after 5 seconds of the mouse being out, not instantly. Here's ...