The collapse feature in Bootstrap 4 is a reliable way to make

I'm struggling to get 2 divs placed side by side. It seems like a simple task, but my divs keep collapsing no matter what I try. Even when I expand the screen, they refuse to stay in place. I've successfully done this before, so I know it should work. Can someone please double-check my approach. Using Bootstrap 4.4.1

<div class="row justify-content-center">            
        <div class="col-5" style="background-color:red">    
            <p>Select your Wi-Fi Network</p>    
        </div>    
        <div class="col-5" style="background-color:blue">
            <p>Select your Wi-Fi Network</p>    
        </div>       
</div>

Answer №1

To enhance the structure of your layout, consider utilizing "div class = "row" instead of just row.

<div class="row">
        <div class="col-5" style="background-color:red">
            <p>Choose Your Wi-Fi Network</p>
        </div>
        <div class="col-5" style="background-color:blue">
            <p>Select a Wi-Fi Network</p>
        </div>
</div>

Answer №2

To create a responsive div, utilize the container class along with rows and columns.

<div class="container">
 <div class="row">
   <div class="col-sm-6" style="background-color:green">
     <p>Choose your favorite color</p> 
   </div>
    <div class="col-sm-6" style="background-color:purple">
            <p>Choose your favorite animal</p>    
    </div>
   </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

Creating a vertical scrolling marquee to showcase a list in React - step by step guide

Trying to create a marquee effect that displays a list of items in a vertical auto-scroll. After reaching the end of the list, I want it to loop back to the beginning seamlessly for continuous animation. The code snippet below shows my progress so far - a ...

Modify the styling of multiple divs using a loop when the page is first loaded

I am working on a loop that generates multiple boxes with masonry layout containing post excerpts. <div class="box"> <div class="image"> <img src="" /> </div> <div class="info"> <h3>//title output with ...

The alignment of floating elements will be off

I am looking to ensure that each element is the same size and properly aligned. Currently, elements with fewer total weeks appear lower due to spacing issues as shown in the image below. https://i.sstatic.net/EytLu.png While I can add phantom rows to fix ...

Troubles with Conditional Application of CSS Styles to a Twitter-Bootstrap Table

I am facing an issue with highlighting a row in a table when a barcode is entered. Despite following similar scenarios and checking my code, the CSS doesn't seem to be applied. Can anyone help me figure out what I'm missing or how I can fix this? ...

Unable to view newly added components

I am currently in the process of setting up a website, focusing on arranging and formatting everything on the page before moving on to styling and adding JavaScript. I recently added three div tags after my form to create three separate columns in the ne ...

Modifying the appearance of scoped child components in Vue: A step-by-step guide

I am currently using vant ui components in my Vue project, such as buttons. I would like to make some minor style adjustments, like changing the color and border, but I am unsure how to do it. Can anybody please assist me in solving this issue? Thank you i ...

What is the best practice for incorporating CSS and JavaScript files into a PHP template?

I've created a basic template for my PHP website, but I'm struggling to find the best way to include my CSS and JavaScript files. Take a look at my index.php file below: <?php include'core/template.php'; $temp=new Template(); $sett ...

Tips for implementing an autoscroll feature in the comments section when there is an abundance of comments

Having a large number of comments on a single post can make my page heavy and long sometimes. This is the current layout of my post comment system: Post 1 Comment for post 1 //if comments are more than 3 <button class="view_comments" data-id="1">Vi ...

Is it possible to disable the pointer event on the parent element only in CSS

Here's the structure I'm working with: <div class='offline'>some text <button class='delete'>Delete</button></div> I want to disable the div using pointer-events: none, but still keep the button activ ...

The menu shifts the remaining parts of the page downwards as it expands

Is there a way to prevent my menu from impacting the code below it? I have considered using position:fixed; to address this issue, but I am not entirely certain. Here is the jsFiddle link for reference: http://jsfiddle.net/chaddly/u9EEt/#base ...

My current table design in bootstrap is having trouble displaying properly, with empty columns appearing when I

I'm having an issue with my table that has striped rows. The columns Name, Description, and Actions are not showing up as expected. Even though the sample codes for the table work fine, there seems to be a problem in my implementation. Can someone ple ...

CSS - setting the background-image property is not displaying the image

.main_banner { background-image: url("../images/main_banner.png"); width: 100%; height: auto; } <!DOCTYPE html> <html> <heading> <title> ********** </title> <link rel="sty ...

Tips on displaying a div element using jQuery

What is required: I simply need to display a div. Code snippet: <a href="javascript:void(0);" id="viewdetail" onclick="$(this).show();" style="color:green">View Detail <div class="speakers dis-non"> </div> </a> After ...

What is the best way to modify properties in the DOM by accessing and changing the inline CSS style attribute with jQuery?

Need assistance with dynamically changing the document object model (DOM). Looking to access and manipulate the 'text-align' and 'line-height' properties. For instance: <p style="line-height:1.0;text-align:justify;"> Interested ...

Is it possible to share a point array or shape between SVG shapes? Can CSS be used to define an SVG shape?

I've scoured the internet looking for a solution to my problem, but nothing seems to work. Is it possible to have multiple SVG shapes share their shape by defining it in one central location? From what I've researched, it looks like SVG shapes ca ...

When an SVG component is contained within an "i" element, the color does not change when the div is hovered over

Is there a way to make the "icons" change color to yellow when hovered over, similar to the text? I tried using .navbar-list-item i:hover, but it only works when the icon itself is hovered over, not the div that contains it. This issue arises due to a pre ...

Firefox not responding to mouse movements

I am experimenting with creating an "animation" using JavaScript's "mousemove" Check it out here This is the code I am currently using $("body").mousemove(function(e){ var wWidth = $("body").width()/2 var wHeight = $("body").height()/2 var posX; v ...

Creating stylistic layouts for text using CSS

After spending the last hour designing a web page, I am stuck on a particular issue that I just can't seem to solve. I need to write several paragraphs while adhering to two specific constraints: 1) The div in which the text resides must be centered ...

Choose a navigation item from the list containing a nested span element

I've implemented selectnav from GitHub and it's functioning perfectly. However, my menu consists of list items with a description span inside each one, resulting in menu items structured as shown below: <li><a href="somelink.html">Ch ...

Multiple Class Changing Effects: Hover, Fade, Toggle

I have a simple yet complex problem that I am trying to solve. I want to create links that fade in upon mouseover and fade out when the mouse moves away. Simultaneously, I want an image to slide in from the left while hovering over the links. I have manage ...