A row consisting of both a container-fluid and a regular container

Is there a way to create a row with two columns, where the first column has a "col-6" with a "container" and the second column has a "col-6" with a "container-fluid"? I attempted to write the code below.

HTML

<div class="main">
    <div class="container">
      <div class="row">
        <div class="col-sm-6 c-1">
          <div class="container">
            <div class="row">
              <div class="teste col-sm-12">aaaaa</div>
            </div>
          </div>
        </div>
        <div class="col-sm-6 c-2">
          <div class="fluid-container">
            <div class="row">
              <div class="teste2 col-sm-12">aaa</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

CSS

.col-sm-6 {
  height: 700px;
}

.c-1 {
  background: #ccc;
}

.c-2 {
  background: #ddd;
}

.teste {
  background: cyan;
}

.teste2 {
  background: blue;
}

The desired layout is shown in the images linked below:

https://i.sstatic.net/Sd45J.png https://i.sstatic.net/9pUqE.png

Answer №1

Recently, I encountered the same issue myself. Depending on the version of Bootstrap you are using (I utilized the latest Bootstrap 5.1), you can see how I tackled a similar problem in a recent project by visiting this link: https://www.example.com/code-sample

To achieve a full-width display of the column on the right, I adjusted the column offset. The code I implemented is also responsive and adjusts for mobile viewing.

This approach works because columns that are offset will be shifted to one side. By adding the class p-0 to the column, you can create a full-width column without any padding. For more details on this technique, refer to the documentation here: https://getbootstrap.com/docs/5.1/layout/grid/#offsetting-columns

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

Include an additional tag solely by using a specific set of keys predetermined in advance

After getting inspiration from Stackoverflow, I decided to enhance my text-box with a tagging feature. The first step was downloading and adding the http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js file to my ASP.NET web folder, allowing me to u ...

Full-screen mobile menu with sliding animation

I currently have a slide-out menu on my webpage, which is 350px wide let menuGeneral = $('#menu-general'); $('#menu-up-control').click(function () { menuGeneral.animate({ right: '0' }, 500); }); $(&a ...

Autofill functions may not be compatible with input fields generated using JavaScript

Having trouble with browsers not using autocomplete in login overlays generated with JavaScript? It can be really annoying. Any suggestions on how to fix this issue? Should I create a hidden form within the original HTML and then move it into the overlay? ...

Comparison between extensive CSS and extensive HTML

Would it be more beneficial to limit the number of classes and IDs in your HTML code to keep it compact, or is it preferable to embrace nested CSS for a more organized structure? Here are some advantages of each approach: Advantages of using minimal nest ...

Continuously encountering a Django form error stating "this field is required" despite completing the field

Just started working on a Django web app and I'm diving into Django forms. However, I keep encountering this error message despite entering the project name field. <tr><th><label for="id_title">projectName:</label>&l ...

Clickability issue with searchbar results caused by onBlur event

My searchbar functionality includes showing results in a dropdown list when the user searches. However, I am facing an issue with the onBlur event that changes the display of the list to none when the user clicks away from the search box. The problem aris ...

Is the JavaScript click event ineffective for <select> <option>s?

It seems like there's a problem with the code below that is causing it to not work as expected. I'm trying to figure out why the onclick events on the <option>s are not triggering, but everything else seems fine. function displayInput() ...

Damaged background in Bootstrap interface modal

https://i.stack.imgur.com/nTAnK.png Is there anyone who can assist me in identifying the issue causing the broken or irregular backdrop in the background of overlays or pop-ups? $scope.Modal = $modal.open({ animation: true, ...

Using jQuery to retrieve the nth child from a table after dynamically creating it with AJAX

When using AJAX in the code below, I fill and create simple data after retrieving it. $.ajax({ method: 'GET', url: '/analyzePage/searchTag/' + tagName, contentType: false, processData: false, success: function (data ...

Creating a full width and height slider with a header menu that is responsive to all device screen sizes

Looking to create a full-width slider with a header that adjusts for all screen sizes, especially larger devices. I've been searching online but haven't found a satisfactory solution yet. If anyone has any ideas or tips on how to achieve this, pl ...

"Incorporating a hyperlink into a newly added table row with the help

When utilizing jQuery, I am able to dynamically add rows to a table with each row containing an anchor tag. However, when attempting to populate the anchor tags with links using jQuery, the links do not appear as expected. Strangely enough, the other data ...

What is the best way to apply the !important property in jQuery for CSS styling?

When setting the CSS property "padding-top" to a value stored in a variable (currentHeight), such as: jQuery("#page-container").css("padding-top", currentHeight); It functions correctly and produces: <div id="page-container" style="padding-top: 115px;" ...

Is it possible to have multiple forms on a master page?

Regarding the limitation of having only 1 runat="server" and <form> per master page, I am facing a dilemma with placing my login form on my website. Should I include it all on the master page or distribute some elements to the .aspx form? Currently, ...

What is the best way to separate content into columns with a border in WordPress?

Currently, I am in the process of creating an event list for a music band website using WordPress. The layout of the list consists of two columns, and my goal is to alternate the placement of each event so that they appear in a left-right-left pattern. Ho ...

Shift icon position to the right using CSS

I designed a user interface that includes an icon, user name, and phone number. The CSS properties I applied to the image are as follows: float: left; position: relative; margin-left: 4%; When I increase the margin-left value, both the image and username ...

Is there a way to determine if the Acrobat plugin is installed and the web viewer setting is enabled using jQuery and C#?

Is there a way in jQuery or C# (as I am currently working on an .aspx page in Sharepoint 2010) to detect if the Adobe Acrobat plugin is installed and if the web viewer setting is enabled? I understand that the plugin is usually installed with Adobe Reader ...

Retrieving checkbox value upon form submission

Imagine having a form containing several checkboxes. Upon submitting the form, you aim to display all values of the selected checkboxes. <form> <input type="checkbox" id="product1" name="product1" value="12"> <input type="checkbox" id="prod ...

Enhancing the appearance of your website by incorporating external stylesheets and utilizing multiple class names through

Is it possible to use external CSS frameworks like Bootstrap, Semantic UI, or Foundation and still generate base64 class names? This could be achieved if there was a way to apply multiple class names. Currently, you can only assign one class name like thi ...

I am experiencing difficulties with my WordPress page and posts not loading properly on the webpage

After successfully converting my HTML template to WordPress by updating all the extensions to PHP, I noticed that all my template parts are functioning correctly. However, I am facing an issue where my WordPress posts and pages are not loading on the web ...

Attempting to store an array in a database while avoiding duplicate entries

English is not my first language, so I apologize in advance if my explanation is unclear. I am currently working on developing a game where each player is assigned a specific role. However, I've encountered an issue with repetitive numbers being inser ...