Show off on social media but not in person

Check out this HTML snippet:

<div class="d-sm-flex flex-sm-row flex-sm-row-reverse">
   <div class='ml-2'></div>
   <div class='ml-2'></div>
   <div class='ml-2'></div>
</div>

Everything seems to be working fine, but in XS mode I want the columns to display as usual. However, if I change the div classes to col ml-2, it messes up the flex display. Any suggestions on how to make it show cols in XS and flex in SM and above?

Answer №1

After reading your feedback, I've come up with a solution:

<div class="container">
  <div class="row">
     <div class='col-4 col-sm-12 ml-2'>TEST</div>
     <div class='col-4 col-sm-12 ml-2'>TEST</div>
     <div class='col-4 col-sm-12 ml-2'>TEST</div>
  </div>
</div>

I utilized Bootstrap's row and col classes within a container. The column structure was set to adjust based on screen size: for sm and below, it's col-4 (modifiable), while for larger sizes it becomes col-12 filling the width.

Answer №2

Give this a try!

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
</head>
<body>
<div class="d-flex flex-row-reverse">
   <div class='col ml-2'>11</div>
   <div class='col ml-2'>22</div>
   <div class='col ml-2'>33</div>
</div>
<div class=" d-flex  flex-row-reverse">
   <div class='ml-2'>44</div>
   <div class='ml-2'>55</div>
   <div class='ml-2'>66</div>
</div>
</body>
</html>



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

Can CSS calc() achieve modulus behavior?

Is it possible to dynamically adjust the height of an element based on screen size using calc(), while still maintaining alignment with a specified baseline grid? The height should always be a multiple of the defined variable $baseline. I've noticed ...

HTML5 header video with a subtle color palette

Is there a way to insert a muted video in the header that spans the full width but only has a height of 300px? The issue I am encountering is that when I decrease the height of the video, the width automatically decreases as well. However, what I want is ...

Guide to changing the background colors of multiple elements when hovered over by the mouse?

I want to customize my website's search bar by changing the background color when it is hovered over. Currently, the search bar has two main elements: the text box and the submit button. I have successfully programmed the text box element to change to ...

Utilizing Font Awesome icons within a JSON structure

I'm running into a bit of trouble trying to display font awesome icons. The text is written in json using a rakefile, and I'm attempting to insert a font awesome icon within the text. However, I'm facing difficulties because the text is in j ...

Using a CSS button to activate a JavaScript function: A step-by-step guide

My current project involves writing a script to change the color of text when a specific button is clicked. The idea is that clicking the "Change color1" button triggers the text color change using the following code snippet: <button onclick="myFunction ...

Issue with tab focus causing dropdown menu to be unresponsive

I'm currently experimenting with a bootstrap example featuring a dropdown menu. Here is the live example: http://jsfiddle.net/p73vc8Lv/ My goal is to have the dropdown menu display when the user clicks on the link. I've attempted to achieve thi ...

Utilizing media queries for responsive design in CSS

I've been working on aligning the page content for different browser sizes using CSS. However, I'm having an issue with the first @media statement - no matter what changes I make in there, it doesn't affect the layout. I've been using ...

Unfortunately, CSS3 PIE is not compatible with border-radius and box-shadow properties

I created a basic HTML/CSS code for testing purposes, but I'm having trouble getting the library to function properly. I've placed the .htc, .php and .js files in the same directory as index.html, but it just won't work. Check out the code ...

Is there a way to alter the color of the weekday header in the Date picker calendar?

I'm working on enhancing the accessibility of my website by changing the default blue color of the weekdays header (highlighted area in the screenshot). I've attempted to modify the CSS code below, but no matter which color code I use, I can&apos ...

Strange rendering in CSS JQuery Datatable

I am encountering an issue with a DataTable from datatables.net. Each row can be selected by clicking on a checkbox, which triggers a click event. In response to the event, I add or remove a CSS class to change the appearance of the selected rows. $(".cbD ...

Could it be that the lower right corner of the border has vanished?

Some items in my list have borders on the left and right sides, but I am experiencing unexpected white gaps only on the right side. I have been unable to identify the issue despite going through my code multiple times. Any assistance would be highly appre ...

AMP: Switch CSS Style

When creating an amp template, I included a button that toggles the visibility of an amp-sidebar. The code for the button is as follows: <button class="button .closed icon" on='tap:sidebar1.toggle'></button> The side-bar toggles suc ...

"Creating a HTML Table with Merged Cells using colspan and rowspan

Creating an HTML table with a unique layout is my latest project. I envision it to look like this: +-------+---+ | | | +-------+ + | | | +-----+-----+ | | | +-----+-----+ To achieve this, I'm utilizing a colgroup to split t ...

Mastering the art of incorporating live JavaScript search functionality that updates in real-time as the user continues typing on the same

Trying to implement a JavaScript search feature to find a div within the same page. The current code being used for the search query display is: $('.form-search').on('submit',function(){return false;}); $('.form-search .btn') ...

Restoring styles back to the default CSS settings

I am currently working on creating visualizations using D3, and one challenge that I have encountered is the need to define a lot of styles within my code instead of in my CSS where I would prefer them to be. This necessity arises mainly to support transi ...

Tips for adjusting text to fit within a container without needing to use overflow:auto

Is there a way to prevent text overflow in a container without using the overflow:auto property? I've come across plugins that automatically reduce the text size, but I'm not keen on that solution. What I want is for long words or URLs to wrap on ...

Can Selenium be used to retrieve a list of pinned IDs from a website?

I am currently developing a web scraper that is required to open multiple tabs of items with filled icons. Specifically, each page that needs to be opened contains the div class="course-selector-item-pinned" in its source code. <dropdown-conte ...

Creating a dynamic word cloud in D3: Learn how to automatically adjust font sizes to prevent overflow and scale words to fit any screen size

I am currently utilizing Jason Davies' d3-cloud.js to create my word cloud, you can view it here 1. I'm encountering an issue where the words run out of space when the initial window size is too small. To address this, I have a function that cal ...

Utilizing jQuery for seamless transitions between multiple background images

Looking to create a dynamic page using jQuery that alternates between different large background images for a fading effect. How can I achieve this? ...

Using a 100vh flex-item won't display at full height

My goal is to create two equal divs in the viewport that span the full height. I am utilizing Bulma for this task, however, I have a suspicion that the issue may not be related to it. HTML <div class="columns"> <div class="column is-flex is-fl ...