tips for adding multiple elements in a row using bootstrap 4

I recently started using bootstrap-4 to design a single page in HTML. However, I am encountering some challenges in making it responsive for various devices like Laptop-L, Laptop-M, and iPad. Currently, the design is only working properly for Laptop-L but not for M size and iPad. Can someone review my code and provide suggestions on how to resolve this issue?

Below is the code snippet:

<div className="row">
    <div className="col-md-10">
        <div className="row">
            <div className="col-md-4">    
                <div className="fontStyle">
                    <span className="">1</span>
                    <!-- <div className="displayBlk"> -->
                    <label type="text">Select Technology</label>

                        <select value=""  className="selectpicker btn btn-labeled btn-start">
                            <option value="">None Selected</option>
                            <option value="">Hello </option>
                            <option value="">World </option>
                        </select>
                    <!-- </div> -->
                </div>
            </div>
            <div className="col-md-4 rowOne">
                <div className="fontStyle">
                    Select Question Type                    
                    <button type="button" class="btn btn-primary btn-sm">Code Type</button>
                    <button type="button" class="btn btn-default btn-sm">Non Code Type</button>
                </div>
            </div>
            <div className="col-md-4">
                <div className="fontStyle">
                    Number Of Questions
                    <select value="" onChange="" className="selectpicker btn btn-labeled btn-start">
                        <option value="">Select</option>
                        <option value="">01</option>
                        <option value="">02</option>
                    </select>
                </div>
            </div>
        </div>
        <!-- end of 10 col row -->
    </div>
    <div className="col-md-2">
        <span className="">
            <button type="button" class="btn btn-outline-primary btn-sm">Reset</button>
        </span>
        <span>
            <button type="button" class="btn btn-primary btn-sm">+</button>
        </span>
    </div>
</div>
<!-- end of main row -->

Initial layout on L-Size Screen:

first screen output

Responsive layout on M-size Screen:

second screen output

Desired final layout:

actual output

If anyone can offer guidance on achieving the desired design, I would greatly appreciate it.

Thank you for your assistance!

Answer №1

Consider transforming it into a table, given the appearance in your images. It's advisable not to overcrowd elements in a Grid Formation.

For instance, take a look at this snippet from your code:

<div className="col-md-2">
    <span className="">
       <button type="button" class="btn btn-outline-primary bt-sm">Reset</button>
    </span>
    <span>
      <button type="button" class="btn btn-primary btn-sm">+</button>
    </span>
 </div>

A more efficient structure could be:

<div class="col-md">
    <span className="">
        <button type="button" class="btn btn-outline-primary bt-sm">Reset</button>
    </span>
</div>

<div class="col-md">
    <span className="">
      <button type="button" class="btn btn-primary btn-sm">+</button>
    </span>
</div>

Ensure each element is responsive within its own context to prevent layout discrepancies. This practice is particularly crucial when dealing with buttons and text on varied z-axis levels.

Apply this concept consistently throughout your codebase.

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

Issues with the creation of an AngularJS table are causing functionality to malfunction

2021 UPDATE: Note: This question was drafted when I was still learning HTML and JS. If you are seeking assistance for an issue, this might not be very useful as my code was messy. Sorry for any inconvenience caused. The question will remain posted in acco ...

Customize a bootstrap 4 WordPress theme by adding a distinct class to the final row

After researching various methods to assign a unique class to the final row of a bootstrap 4 grid layout, I struggled to find examples that specifically targeted the start of the last row. Despite this challenge, I eventually resorted to some basic mathema ...

The challenges of $location.search().name and base href in application URLs

I am working on an Angular app and my URL appears as http://localhost:8080/personal?name=xyz. To extract the 'xyz' value in JavaScript, I am using $location.search().name. Here is a snippet of my code: app.js app.config(function ($locationProv ...

Finding content in HTML tables using JavaScript and jQuery

I recently created a table and wanted to add a search functionality to it. I searched online, including on various forums like StackOverflow, but unfortunately, the solutions I found did not seem to work for me. Below is the code that contains both the HT ...

Utilizing media queries in AMP for optimizing mobile website performance

Recently, I delved into the realm of utilizing AMP for my blog. After perusing the documentation and observing examples of its application, I must say that anything enhancing performance is a welcome addition to me. Therefore, I am keen on incorporating i ...

The inefficiency of invoking Jquery on elements that do not exist for the purpose of caching

What is the impact if JQuery attempts to access elements that do not exist? Will there be any significant CPU overhead other than script loading? Does it matter if this is done for a class or an id? For optimization purposes and to minimize simultaneous c ...

Showing a PDF file within a Bootstrap modal

I'm encountering difficulties with a simple task. My goal is to display a PDF using the HTML <object> tag within a Bootstrap modal. I've put together a Plunkr to illustrate the issue. Essentially, there is a straightforward <object> ...

The Bootstrap Datepicker is always set to display a date that is one day earlier than the selected date

I have encountered an issue with the Bootstrap date-picker where the selected date appears to be one day less when passed to the backend. For example, the date I select in the UI is 04-Apr-1997, but the date shown in the console is 1997-04-03T18:30:00.000Z ...

A guide to deactivating the Material UI Link API element

Previously, I relied on Material UI's Button component with a disable property that allowed the button to be disabled based on a boolean value. However, I now want to use the Material UI Link component, which resembles a text link but functions like a ...

Arranging the data in the table by alternating rows using Datatables

I need to organize my data in a way that includes an additional row for descriptive information, but this particular row should not be sorted. It is crucial for understanding the rest of the data, so hiding or showing it is not an option. Is it possible t ...

What is the best way to incorporate markers into my d3 line chart that includes two separate datasets?

In my JavaScript code, I'm creating a line chart for two datasets using the d3 library with Vue framework integration. Within the HTML code, there are buttons that trigger the updateData function to display the line charts for the respective datasets ...

Can multiple bootstrap classes be merged together?

Using various bootstrap classes multiple times within an HTML <form>. Example: <form id="frmData" name="frmData" method="POST"> <div class="row justify-content-sm-center mb-2 align-items-center"> ...

Strange floating elements wrapping inside Bootstrap 3 column divs

Essentially, I have a series of twitter-bootstrap square divs with classes like col-md-x, col-sm-x stacked together to form an image list. It's functioning smoothly for the most part. However, there are instances (which remain a mystery to me) where t ...

Error in WebGL rendering: attribs are not configured properly

Below is the code for my vertex shader: attribute vec3 aVertexPosition; attribute vec4 aVertexColor; attribute float type; uniform mat4 uMVMatrix; uniform mat4 uPMatrix; varying vec4 vColor; void main(void) { gl_Positi ...

challenges arising from using the css overflow: hidden attribute

Struggling with a popup displaying issue caused by an overflow: hidden property on the containing div. The background graphics of the popup are crossing over due to this setting, leading to a display problem where the width is cut off at the overflow bound ...

Analyzing JSON data and creating a tailor-made array

My Dilemma { "rowId": "1", "product_name": [ "Item A", "Item B", "Item C", "Item D", "Item E" ], "product_tag": [ "123456", "234567", "345678", "456789", "5678 ...

Is it possible for me to utilize a validation function to display error messages within a specific span id tag?

document.getElementById("button1").addEventListener("click", mouseOver1); function mouseOver1(){ document.getElementById("button1").style.color = "red"; } document.getElementById("button2").addEventListener("click", mouseOver); function mous ...

Constantly changing the size of an IFrame due to CSS View Height

I am facing an unusual issue with the CSS property vh (viewpoint height), causing my iframe to expand uncontrollably. To explain, within my iframe code, I have the following: function sendPost() { setInterval(funct ...

How can I iterate through XML nodes using JavaScript?

I attempted to iterate through list items from an XML file using JavaScript. However, the list data is not displaying with bullet points. Below is my code: Data.xml <?xml version="1.0"?> <paintings> <cd> <para>posuere lacus in, ...

Is there a way for a DOMWindow popup to automatically resize to fit its

Currently exploring JQuery and learning on the fly, I'm wondering if there's a method to automatically adjust the size of a DOM window based on its content? I've successfully modified the parameters to accept % width and height instead of p ...