Misaligned tabs within Bootstrap Modal

Currently, I am working on creating a Bootstrap Modal that includes tabs for easy navigation within the modal. However, I have encountered an issue where the tabs are not aligned properly as shown in the image linked below:

View Image Here

This is the code snippet I am using to build the modal in JavaScript:

BootstrapDialog.show({
          title: "Vouchers Details",
          closable: false,
          message: `
             <!-- Tab creation -->
    <ul class="nav nav-tabs" role="tablist">
      <li class="nav-item">
        <a class="nav-link active" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-toggle="tab" href="#menu1" role="tab" aria-controls="menu1" aria-selected="false">Menu 1</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-toggle="tab" href="#menu2" role="tab" aria-controls="menu2" aria-selected="false">Menu 2</a>
      </li>
    </ul>

    <!-- Tab content -->
    <div class="tab-content mt-3">
      <div id="home" class="tab-pane fade show active" role="tabpanel" aria-labelledby="home-tab">
        <h3>HOME</h3>
        <p>Some content.</p>
      </div>
      <div id="menu1" class="tab-pane fade" role="tabpanel" aria-labelledby="menu1-tab">
        <h3>Menu 1</h3>
        <p>Some content in menu 1.</p>
      </div>
      <div id="menu2" class="tab-pane fade" role="tabpanel" aria-labelledby="menu2-tab">
        <h3>Menu 2</h3>
        <p>Some content in menu 2.</p>
      </div>
    </div>
          `,
          buttons: [
            {
              label: "Dismiss",
              action: function (dialog) {
                dialog.close();
              },
            },
          ],
        });

I need assistance with aligning these tabs correctly. I have tried using various bootstrap classes and custom CSS/HTML but have been unsuccessful in resolving this alignment issue.

Answer №1

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ed8f8282999e999f8c9dadd8c3dec3de">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg bg-body-tertiary ">
  <div class="container-fluid bg-primary p-2 ">
    <a class="navbar-brand text-white" href="#">Voucher Details</a>
   <div class="justify-content-end mr-2"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="SupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="SupportedContent">
      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
        <li class="nav-item">
          <a class="nav-link active text-white" aria-current="page" href="#">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link text-white" href="#">Menu1</a>
        </li>
        <li class="nav-item">
          <a class="nav-link text-white" href="#">Menu2</a>
        </li></div></div></nav>

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

Sending data from an element within an ngFor loop to a service module

In my component, I have a loop that goes through an array of different areas with unique IDs. When you click the button, it triggers a dialog containing an iframe. This iframe listens for an event and retrieves data as JSON, then sends it via POST to an IN ...

Issue with JQuery Validation: Some checkbox values are not being successfully posted

Currently experiencing issues with validating checkboxes. Utilizing the jQuery plugin validation found here: The scenario is that there are three checkboxes and at least one of them must be checked. The original form code for these checkboxes is as follow ...

Tips for making vertical-align middle compatible with display inline-block

html <ul class="tabs-bottom"> <li><a href="#tab-1">Booking</a></li> <li><a href="#tab-2">Special Offers</a></li> </ul> css .tabs-bottom{ list-style: none; margin: 0; padding: 0; } . ...

Tips for updating or toggling an icon within a button with the help of Bootstrap 5 and jQuery

Looking to switch the icon displayed inside a button upon clicking? The initial icon is <i class="fas fa-bars"></i>, and after being clicked, it should change to <i class="fas fa-times"></i>. How can this be ach ...

What is the process for attaching a JavaScript function to execute upon resizing of a browser window?

Is it possible to register a JavaScript function that will execute when the browser window is resized? I have a feeling it may be found within the Page.ClientScript class methods, but I find myself a little lost. ...

Property-based Angular Material row grouping in a mat-table is a powerful feature that enhances

Is there a way to organize the data in one row with the same ID? Currently, my data looks like this: Data Set: { "id": "700", "desc": "Tempo", "richiesta": "20220087", "dataElab": &quo ...

Changing the border color of material ui Rating stars: A guide

I am struggling to change the border color of stars in Material UI Rating because my background color is black, making it difficult to see when the star is empty! Here's the code snippet: import Rating from '@material-ui/lab/Rating'; import ...

Can Javascript be used to identify the number of td elements in a table and specify column widths within the table tags?

Is there a way to automatically add the "col width" tag based on the number of td tags within a Table tag? For example, if there are 2 td's, then it should add 2 "col width", and if there are 3 then, 3 "col width", and so on. <!DOCTYPE html> &l ...

CSS Hack for Internet Explorer 7 Fix

Dealing with styling in IE7 can be quite challenging, especially when working within a WebCenter Portal application where conditional statements cannot be used to load specific stylesheets. Instead, skins are utilized, which are essentially CSS files. Is ...

Difficulty in decoding intricate JSON response using JQuery (or simply JavaScript)

Consider the function below, which retrieves JSON data from a Solr instance: var url = "http://myserver:8080/solr/select?indent=on&version=2.2&q=(title:*Hollis* OR sub_title:*Hollis*+OR+creator:*Hollis*+OR+publisher:*Hollis*+OR+format:*Hollis*++OR ...

Oops! The Route.get() function in Node.js is throwing an error because it's expecting a callback function, but it received

Currently, I am learning how to create a web music admin panel where users can upload MP3 files. However, I have encountered the following errors: Error: Route.get() requires a callback function but received an [object Undefined] at Route. [as get] (C:&bso ...

Utilize .NET MAUI Blazor's customizable light and dark themes by loading unique stylesheets through the headcontent feature

I am currently working on a .net MAUI Blazor Hybrid app and I am looking to create both a dark and light theme using CSS stylesheets, without relying on MudBlazor. My approach involves using two separate CSS files, lightMode.css and darkMode.css, each con ...

Creating a unique layout with CSS: layered divs

I'm struggling with a stubborn layout issue that I just can't seem to figure out... - Left column - Fixed, Static (always in view) - Right column - Fluid/liquid/scrollable --- Header - fixed --- left/main fluid/liquid --- Right/sidebar - fixed ...

Does HTML files in apps utilize drawable files stored within the apps?

Working on an Android app with a webview, I encountered an issue where setting an image as the background was being "overwritten" by the webview itself, preventing me from using the direct background from XML. I came up with a solution to insert the image ...

When attempting to transfer code from my local environment to Google Action/Dialogflow, no progress is made

I'm currently working on creating a Google Action in Dialogflow. Specifically, I am trying to deploy JavaScript code from my terminal. A few days ago, everything was running smoothly. Here is the index.js file that was working: 'use strict&apos ...

Using Jquery to compare a user input with values in an array

Utilizing an ajax call in jQuery, I successfully retrieve a JSON file and access its values. However, the next step is to extract a value from the object array and compare it with an input source. If the comparison returns true, then display it within a sp ...

A-Frame VR: Image missing from display on Chrome browser

UPDATE: I discovered that the issue was caused by running the HTML file from my local hard drive instead of a web server. Once I uploaded it to my web server and ran it from there, everything worked perfectly. A-Frame Version: 0.4.0, Chrome: 55.0.2883.87, ...

Bootstrap can be utilized to align elements at the bottom of

I am struggling with getting the align bottom feature to work properly in Bootstrap 4. Here is the code I have been using. I am aiming for the text to be aligned at the very bottom of the line. Using margin/padding is not an option, especially when the te ...

populate first and then aggregate all the data in mongoose

My goal was to first populate and then aggregate data Comps.find().populate({ path : "reviews", model : "Review" }).exec(function(err, populatedData){ if(err) console.log(err) console.log("populatedData--", populate ...

Create data according to jQuery's AJAX data method

When editing in place using jQuery, if the code snippet seems too complicated, please refer to a simpler one. 'column2' => "RAJANgsfdgf" 'column3' => "SRARDHAMgsdfgdf" 'column4' => "40043433" 'column7' =&g ...