Ensure the proper fit for smaller screens

While using Bootstrap 4 and incorporating Stream UI Kit for the user interface within my application, I've encountered an issue where the column size doesn't display correctly on smaller screens!

For example: https://i.sstatic.net/mUekg.png

On mobile browsers, it should ideally display one column per line! You can view the demo to confirm this.

<!-- Campaigns Grid -->
    <section class="pt-11 pb-6 bg-light">
        <div class="container">


            <div class="d-flex justify-content-between align-items-center mb-5">
                <h2 class="h3 text-center">{{ trans('user.offers') }}</h2>
                <a href="{{ url('/campaigns?type=offer') }}" class="btn btn-outline-primary">{{ trans('user.all') }}</a>
            </div>

            <div class="row">
                @foreach($offers as $demand)
                    <div class="col-md-4 mb-5">

                        <div class="card h-100 border-0 shadow">
                            <a href="{{ url('/campaign/'.$demand->id) }}" class="d-block bg-gradient rounded-top">
                                <img class="card-img-top hover-fade-out" src="{{ url('upload/campaign/'. $demand->cover .'/') }}" alt="{{ $demand->title }}"  height="244">
                            </a>
                            <div class="card-body">
                                <a href="{{ url('/campaign/'.$demand->id) }}">
                                    <h3>{{ $demand->title }}</h3>
                                </a>
                                <p>
                                    {!! str_limit(strip_tags($demand->content), 128) !!}
                                </p>
                            </div>
                            <div class="card-footer d-flex">
                                @foreach($demand->categories as $category)
                                    @if(App::isLocale('ar')) <a href="{{ url('/category/'.$category->id) }} " class="badge badge-pill badge-secondary mr-1" >{{ $category->title_ar }} </a>
                                    @elseif(App::isLocale('fr')) <a href="{{ url('/category/'.$category->id) }}" class="badge badge-pill badge-secondary mr-1">{{ $category->title }}</a>
                                    @else <a href="{{ url('/category/'.$category->id) }}"  class="badge badge-pill badge-secondary mr-1">{{ $category->title_en }}</a>
                                    @endif
                                @endforeach
                            </div>
                        </div>
                    </div>
                @endforeach


            </div>
        </div>
    </section>
    <!-- End Campaigns Grid -->

Answer №1

To create a responsive layout for all devices, you can utilize the col-md-4 class along with additional classes. Simply include the following classes in one line: class=“col-6 col-md-4 col-sm-4 col-lg-4 col-xl-4” These classes themselves provide responsiveness on various devices, with each targeting a specific screen size category: - col: mobile - col-md: medium devices - col-sm: small devices - col-lg: large devices - col-xl: extra-large devices They will automatically adjust to fit the screen size of the device being used.

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

Ensure that the left menu remains fixed at full page height of 100%

I'm currently working on developing a website layout that includes a left menu bar and right content section, both of which are independently scrollable. However, I'm encountering a few challenges: The left menu bar doesn't cover the enti ...

Stop Element-UI from automatically applying the list-item style to li elements

I have a list of data elements that I am rendering in the following way: <ul> <li v-for="el in elements"> {{el.data}} </li> </ul> Here's how I style it in my .css file: ul { list-style-type: none; padd ...

Troubleshooting: Navbar dropdown menu in AngularJS gets hidden within UI layout

After spending some time trying to understand why the NavBar drop-down is getting overlapped inside the ui-layout, I realize that I must be overlooking some basic steps. This issue seems so simple, yet it is eluding me. To see the details of the problem, ...

What is the best way to insert two rows directly in the middle of two Bootstrap columns?

I need to align two rows in a straight line. Similar to the example shown in the image below: https://i.sstatic.net/EwRat.png After that, I want to split the Bootstrap into two columns, one with col-md-8 and the other with col-md-4. In the col-md-8 col ...

Optimal placement and size for the slick slider

I am new to CSS and currently experimenting with the Slick slider on a project: My setup involves a div container that spans 100% of the width of the page. Inside this container, there is another div (housing the slider) that takes up 80% of the width. D ...

What is the best way to make the cursor display as 'wait' while a script is running?

During the execution of a lengthy javascript function, I would like to change the cursor style to 'wait' and then revert it back to normal once the function is complete. I initially tried using the following code: document.body.style.cursor = &a ...

Position icons and images on the right side, and the textarea on the left side of the page (using Twitter

Summary: Here is the desired end result shown in the image below. Alternatively, you can refer to the JSFiddle. Ideally, only CSS should be used without changing the DOM structure. The icons need to be aligned completely to the right using the .pull-right ...

Is there a way to make a TABLE expand to match the height of its surrounding element? (or, tackling sluggishness in IE with JavaScript)

I am facing a challenge with a web page where I have a table nested inside of a TD tag. Despite the unconventional approach, I need to ensure that the height of the nested table matches the height of the TD cell containing it upon page load. Currently, I a ...

Hovering over a td tag and adding a border using CSS can cause the entire table to

While experimenting on a coding platform: <table> <tr> <td class="changeme">something</td> <td>something</td> <td>something</td> <td>something</td> < ...

Tips for incorporating home and settings buttons into PhoneGap's webview

I am in the process of creating an app using PhoneGap. This app will feature icons for the home and settings buttons at the top of each webview, similar to an actionbar menu in Android. I am utilizing a generated template from ThemeRoller (CSS) for JQuery ...

The jQuery fade speed effect has a limitation where it can only be utilized

When a specific link is clicked, I want a div to display with a fadeIn effect and then fadeOut when the link is clicked again. However, after the first click following an HTTP request, the fadeIn works but the fadeOut does not (the div closes though). More ...

Press on the div to reveal its content at the clicked position

Hello, I have a query that I need help with. I currently have a basic table with buttons in columns that act as filters. When you click on one of these buttons, it opens up a form. https://i.sstatic.net/nuEpq.png What I am trying to achieve is to make t ...

Issue with background/hero video not adjusting its size

I've been experimenting with creating a page that features a video as the background, but no matter what I try, the video never seems to resize properly. The image below shows how it looks: image in question body { margin: 0; } .hero-se ...

Overlap elements without using absolute positioning and prevent resizing distortion

Looking to incorporate a line with tick marks and a ball (similar to a scale) into my design. Some tutorials recommend using absolute positioning or float for this effect. While these methods work partially, I've noticed that the divs tend to shift o ...

What are the steps to create a dynamic navigation menu in Angular 2?

I have successfully implemented this design using vanilla CSS and JS, but I am encountering challenges when trying to replicate it in Angular 2. Setting aside routing concerns, here is the current state of my component: navbar.component.ts import { Comp ...

Struggles with aligning a hyperlink vertically in an unordered list

Here is a simple code I am using to vertically center a hyperlink within a UL. The style is applied to the hyperlink instead of the li because I need the entire list element to be clickable. Although my code works as intended, there seems to be a slight i ...

Dividing image styles within css

I am trying to incorporate 4 arrow images into a CSS class (up, down, right, left). I started with a basic arrow css class: .arrow { background-repeat: no-repeat; background-position: center; } Next, I created subclasses like: .arrow .up { ...

Issue with Firefox: Click event not fired when resize:vertical is set while focusing

Issue: Firefox is not registering the first click event when a textarea has the following CSS: textarea:focus { resize: vertical; } Check out the demo: http://jsbin.com/wuxomaneba/edit?html,css,output The fix for this problem is straightforward - ju ...

What is the best way to align text in the middle on smaller devices like phones and iPads?

I have been working on a login screen and encountered a problem with the layout on smaller devices. Despite centering all the content perfectly on my computer's browser, when I inspect it using developer tools for smaller devices, everything shifts to ...

Creating a unit by merging variables in SASS

Is there a way to merge two variables in SASS to create a single unit together? The current configuration is outlined below: $font-size: 16; $font-unit: px; $base-font-size: {$font-size}{$font-unit} !default; @if unit($base-font-size) != 'px' ...