Reordering columns in WHMCS Template using Bootstrap 4

Currently in the process of redesigning my website's theme powered by WHMCS with Bootstrap 4. I am facing challenges in implementing column ordering in the client area similar to the default "six" template in Bootstrap 3. The goal is to have the Primary and Secondary navigation on the left side in desktop view, with the main content on the right, and in mobile view, the primary navigation should move above the content, followed by the secondary navigation:

Desktop View:

PN | MC
SN |

Mobile View:

PN
MC
SN

Here is the basic layout html:

<div class="container">
    <main class="row">
        <aside class="col-sm-3">
            Bootstrap 4 Card containing Primary Navigation
        </aside>
        <article class="col-sm-9">
            Main client area content
        </article>
        <aside class="col-sm-3">
            Bootstrap 4 Card containing Secondary Navigation
        </aside>
    </main>
</div>

Having difficulty getting the secondary navigation to align on the left below the primary navigation in desktop view; it is currently positioned below the main content. With Bootstrap 4's use of flex-boxes, the previous solution of using a left float in Bootstrap 3 no longer works.

Edit:
Provided below are the fiddles for better understanding:

Note: Removed images as the fiddles demonstrate the same setup.

Answer №1

There seems to be a mistake in the way you are using the bootstrap grid system. The sum of all columns should always add up to 12. I have provided the correct code for you below:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
    <main class="row">
        <div class="col-lg-3 col-ms-3 col-sm-3 col-xs-3">
        <div class="row">
        <aside class="col">
            BS4 Card containing Primary Navigation
        </aside>
        </div>
        <div class="row">
        <aside class="col">
            BS4 Card containing Secondary Nav
        </aside>
        </div>
        </div>
        <div class="col-lg-9 col-ms-9 col-sm-9 col-xs-9">
        <article class="col">
            Main client area content
        </article>
        </d

Don't forget to add a media query for the mobile view to make the secondary navigation position:fixed.

Answer №2

Need a quick fix? Simply follow these steps: Assign the class 'adjust' (or any other name you prefer) to the third column.

<div class="container">
        <div class="row">
            <div class="col-sm-3">
                nav
            </div>
            <div class="col-sm-9">
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Neque temporibus dolorum ea natus nam labore delectus vel, voluptatibus libero eligendi fuga optio! Nisi nemo architecto est, tenetur hic nesciunt distinctio totam repellat necessitatibus. Explicabo nam illum incidunt iusto recusandae nobis eos inventore dolore, suscipit cum earum numquam alias eveniet voluptatem!
            </div>
        </div>
        <div class="row">
            <div class="col-sm-3 adjust">
                nav2
            </div>
     </div>
</div>

Customize the appearance with CSS:

 .adjust{
   position:relative;
   bottom: 100px; /* adjust as needed */

 }

 @media(max-width:768px){
 .adjust{
  position:relative;
  top: 100px; /* modify for desired effect */
  }

 }

Answer №3

I have successfully found a solution to this issue. Although I initially wanted to maintain the flexbox structure on the elements and position them accordingly using flexbox, the following solution works well for the time being.

To begin, I transformed the containing .row along with the inner .col-sm-* items into block-level items using Bootstrap 4's display utilities by including .d-lg-block on all four elements.
Then, I utilized float utilities to position each column as needed. Specifically, I applied .float-lg-left to the first and third columns (the navigation columns), and .float-lg-right to the middle column (the main content).

You can view a demonstration of this solution in action in Bootstrap 4 by visiting this link: https://www.bootply.com/0TrQZNXF1S

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

Using jQuery to apply the "a" class with the addClass method

The html structure below is giving me trouble: <div class="sub"> <a href="#" id="people">People</a> </div> The CSS for the "a" element is as follows: color:#999999; font-size:31px; I am attempting to use jQuery to change ...

Dynamic Display Picture Banner - Adjustable Layout

My home page features a full screen image header that I'm working to make responsive. The width of the image is being cut off on various screen sizes. I've attempted adjusting the height and width settings, but I want the image itself to resize ...

Move a div element as you scroll down the page

I currently have a div that appears when a user scrolls down a page. When clicked, it sends you back to the top of the page. Right now, it simply fades in and out, but I would like it to slide in from the right side of the page. Below is my existing code: ...

Make a flexbox item scroll in the cross-axis once it aligns with the size of another element

In my search, I've come across several questions that are somewhat similar but none quite address the exact issue at hand. While this question on Stack Overflow bears some resemblance, I am specifically looking to utilize a flex element instead of a s ...

Utilizing bootstrap tools and experiencing a deficiency in organization

Looking to utilize utility classes, I am currently importing the latest version of Bootstrap (v4.0.0-alpha.6). However, upon searching through the node_modules files, I am unable to locate any "order-" utility rules. Has this feature been removed? The doc ...

How can I transfer PHP/MYSQL information into a PDF?

I've recently developed a Student Information Form that is linked to a MYSQL database. Now, I'm looking to export all the collected data from the MYSQL DB into a PDF file. Is there a way to accomplish this task? Any suggestions on how to achieve ...

Can you tell me which specific font Adobe Edge Code (Brackets) uses in its code editor?

Can someone please help me? I'm trying to identify the syntax highlighter being used in this code. Is it Prettify or something else? ...

Issue with background image not resizing or repeating correctly on mobile devices

My website header is not scaling properly on mobile devices, causing some issues. The background color with white text using Bootstrap and custom CSS is not extending across the screen on smartphones or when viewed in Chrome Dev Tools. As a result, two ma ...

Is there a method to update the status of a Jquery UI Mobile navbar using Javascript?

I have created a navigation bar using the Jquery mobile UI 1.01 framework; <div id="footer" data-role="footer" data-position="fixed"> <div data-role="navbar"> <ul> <li><a href="#" onClick="toggle_units();" clas ...

The back-to-top button guides users back to their last visited page

I'm excited to explore AngularJS and I want to add two "return to top" buttons on different pages. Here's what I have so far: Page 1: <h1 id = "top"> .......... <a href="#top" target = "_self">Return to Top</a> Page ...

What is the best way to generate two <div> elements, with one of them being centrally fixed?

When it comes to CSS, I must admit that it's not my strong suit. My current challenge is to create two boxes or divs where one remains fixed in the center of the page, while the other adapts and positions itself right next to the first one. Essentiall ...

Difficulty enforcing mandatory checkboxes

Seeking assistance on making checkboxes required. I am creating a form using bootstrap 4 and validating it using the JS example from bootstrap documentation. I have added "novalidate" to the form, "required" to inputs, and included the following script: ...

HTML code that has been "commented out" means

Within my _Layout.cshtml file, the following lines are present: <!--[if IE 7]> <link rel="stylesheet" type="text/css" media="all" href="/Content/css/ie7.css" /> <![endif]--> <!--[if IE 6]> <link rel="stylesheet" type="te ...

css optimizing image content for search engine visibility

My website's main page features a div with an image containing the message "contact us by calling 1 800 blabla..". I'm concerned that search engines may not be able to recognize or find my company's phone number since it is only displayed wi ...

What is the best way to add a hyperlink to my directory pictures?

Recently, I came across this piece of code: <? include "top.php"; ?> <center> <a href='upload.php'><button>Upload Image</button></a> </center> <br> <?php $www_root = 'http://annexsecurit ...

Exploring the depths of complex structures with Selenium to uncover hidden elements

If we look at this particular piece of HTML code: <tr class="highlight"> <td><center><a href="example.code"> Bar </a></center></td> <td><center> Foo </center></td> &l ...

CSS can create a semi-circle shape using borders and outlines

Attempting to craft a CSS circle that mirrors the image below: ...with just a single div: <div class="myCircle"></div> solely utilizing CSS rules. No SVG, WebGL, DirectX, etc. permitted. My initial approach involved constructing a complete ...

Dealing with Overflow in CSS DIV Elements

Link to site: Suddenly, without any changes to the css, I noticed that when I expand the "browse" categories, they overflow outside of the containing divs. Here is the css code for the divs: .bodyArea { width: 900px; background-image:url(/images/ ...

Concerning dilemma with a div element

I am using 2 different partial views in my main view: <div class="col-md-6"> @Html.Action("Chart", "Teams") </div> <div class="col-md-6"> @Html.Action("SeriesWinsChart", "Teams") </div> <div class="next-game"> & ...

The line breaks in elements occur when the combined widths add up to 100%

Is there a way to display an input and a button inline, with the input taking up 70% of the row and the button taking up 30%? I tried setting the CSS for the input to 70% and the button to 30%, but they keep breaking onto separate lines. How can I solve ...