Bootstrap: Altering grid column layout for medium and small/extra-small screens

Hello everyone, I'm having a bit of trouble working with Bootstrap. My goal is to create a container with a row that contains three columns of equal width:

<div class="row">

    <div class="col-md-4" style="background:red;">logo</div>
    <div class="col-md-4" style="background:blue;">content</div>
    <div class="col-md-4" style="background:yellow;">content+imgs</div>

</div>

The issue I'm facing is that I want the 'logo' column to be in the second position (after 'content') on XS/SM devices or when resizing the browser window. I've tried using push and pull, but I want the columns to stack vertically, not horizontally like on MD devices. I'm not sure how to achieve this, any suggestions? :)

Answer №1

By utilizing order classes in bootstrap, you have the flexibility to rearrange columns based on different screen sizes.

For instance, this demonstration showcases how the second column can be displayed first on extra small (XS) and small (SM) screens:

<!--bootstrap 4-->
<div class="row">
      <div class="col-md-4 order-2 order-md-1">first</div>
      <div class="col-md-4 order-1 order-md-2">second</div>
      <div class="col-md-4 order-3 order-md-3">third</div>
    </div>

edit:

If you are using Bootstrap 3 (version 3.3.7), push and pull classes will need to be utilized instead. In your scenario, you'd want to position the logo as the second column. It's important to note that mobile takes precedence in bootstrap framework.

<!-- bootstrap 3 -->
      <div class="row">
        <div class="col-md-4 col-md-push-4" style="background-color:red;">content</div>
        <div class="col-md-4 col-md-pull-4" style="background-color:blue;">logo</div>
        <div class="col-md-4" style="background-color:yellow;">content+imgs</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

The Bar Graph Transition in d3 is Running Backwards

Learning to code has been a fascinating journey for me, but I must admit that JavaScript presents a unique challenge. Currently, I am working on creating a d3.js Bar Chart and I wanted to include a transition effect when the bars load. However, I have enco ...

Adjust the height of a division dynamically

I have the following HTML snippet: <div id="container"> <div id="feedbackBox"></div> </div> The #feedbackBox div is initially not visible. To center the div, the CSS code is used: #container { position: absolute; widt ...

Creating distinct identifiers for CSS JQ models within a PHP loop

Can anyone assist me in assigning unique identifiers to each model created by the loop? I am currently looping through a custom post type to generate content based on existing posts. I would like to display full content in pop-up modals when "read more" i ...

Creating an Android application that integrates HTML styling efficiently

I currently have a social networking site with a mobile web version, and my goal is to package that view into an Android app and potentially enhance it with a custom splash screen. Essentially creating a branded browser window. If you have any tips or adv ...

Exploring for worth using BeautifulSoup

Can anyone help me extract the name of a person (Alex Key) from the following HTML markup: <div class="link_container"> <a class="follow_card" data-uuid="e47443373cfa93d5341ab809f0700b82" data-type="person" data-name="Alex Key" data-permalink="/ ...

Avoid losing focus on href="#" (preventing the page from scrolling back up to the top)

Is there a way to prevent an empty href link from causing the page to scroll up when clicked? For example, if I have: <a href="#">Hello world</a> And this "Hello world" link is in the middle of the page. When clicked, the URL would look like ...

Adjust the canvas size to fit its parent element ion-grid

I am currently working on an Ionic 3 component that displays a grid of images connected by a canvas overlay. I have utilized Ionic's ion-grid, but I am facing an issue with resizing the canvas. The problem is that I cannot determine the correct dimens ...

How to place a circle below text using CSS

I'm attempting to center a 5px x 5px circle under the links in a navigation bar to indicate the current page, but I'm uncertain about how to achieve this effect. Here is the current outcome: Link to Image This is what I aspire to accomplish: Li ...

What could be the reason for the function providing the value of just the initial input?

Why am I only getting "White" when I click on the colors? I can't seem to get any other values to appear on the screen. I'm confused about what mistake I might be making here. var x = document.getElementById("mySelect").value; function myFunc ...

Choose the initial offspring from a shared category and assign a specific class identifier

I am trying to figure out how to apply the "active" class to the first tab-pane within each tab-content section in my HTML code. Here is an example of what I'm working with: <div class="tab-content"> <div class='tab-pane'>< ...

Discovering additional element information while utilizing the 'Sortable' feature

My Current Objective: In my setup, I have a 'calendar' comprising 5 columns, each column containing 5 separate divs known as timeslots. The main purpose here is to show appointments in these specific timeslots and utilize JQuery's Sortable ...

Transform your current website layout from a fixed 960-grid system with 12 columns into a fluid and

As a newcomer to web development, I have successfully created my portfolio website. I initially set the body width to 1600px because that matched the size of my banner background in Photoshop. I'm using a 960gs 12-column grid system, but when I view t ...

What could be the reason that my submenus are not appearing as expected?

I'm currently working on refining the navigation bar design for a website, but I've encountered a problem with the submenu functionality. It appears that only one submenu is visible while the others remain hidden. For example, when navigating to ...

In the case of a PDF being in landscape orientation, the full width of the document is not utilized despite the width being set to

Even though I have specified the width of the Header table to be 100% and applied a margin-right of 1cm for PDF reports with landscape orientation, the table is not taking up the full width. However, when my PDF report has portrait orientation, the header ...

Extracting data from a tiered website within a specialized niche

I am currently attempting to scrape data from the webpage: "https://esco.ec.europa.eu/en/classification/skill_main". Specifically, I want to click on all the plus buttons under S-skills until no more plus buttons can be found, and then save the page source ...

When a HTML table is generated from imported XML, DataTables will be applied

I am facing a challenge with my code and would appreciate some help. I am trying to load an XML file using jQuery and then use DataTables on my HTML table. However, the plugin doesn't seem to be functioning correctly. When I manually create an HTML ta ...

Issue with setting a background image to a div in Next.js: not functioning as expected

I haven't used Next.js before and I'm having trouble setting a background image for a specific div. I have a folder named public in the root directory where I've placed the file art-thing.jpg. My styles.css is also in the root directory, whi ...

Getting Your Content Centered Horizontally with Fixed Positioning in CSS

I would like the div to be centered horizontally with a fixed position, but it doesn't seem to work in my code. Can someone help me troubleshoot? Check out the demo here. HTML: <div id="fancybox-thumbs" class="bottom" style="width: 675px;"> ...

Arranging arrows strategically along a line and ensuring they are positioned correctly above all div elements

I'm really struggling with this issue. I have a situation where I need to center a downward pointing arrow within some divs. It should be positioned in the middle, on a brown line, and on top of everything else. The last div should also include the a ...

I am encountering issues with my JavaScript code not functioning properly

I am currently working on a website project in HTML where I need to retrieve JSON-formatted data using JavaScript and then display it on the site. However, I am facing an issue as I cannot seem to identify any errors in my code. I followed this sample code ...