Decreasing the Height of Modal Header with Tabs in Bootstrap 4

Working with Bootstrap 4, I've set up a Modal Dialog with Tabs. However, I'm facing an issue with the height of the Modal Header containing the Tabs, and I need to decrease it. Here's the current appearance:

Header - Tall

Desired appearance:

Header - Normal https://i.sstatic.net/J3pSw.png

Bootstrap Code used:

<div class="modal fade" id="MyModal" tabindex="-1" role="dialog" 
    aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <div class="tabbable">
                    <ul class="nav nav-tabs" role="tablist">
                        <li class="nav-item active">
                            <a class="nav-link active" href="#AAA" data-toggle="tab">
                                AAA
                            </a>
                        </li>
                        <li>
                            <a class="nav-link" href="#BBB" data-toggle="tab">
                                BBB
                            </a>
                        </li>
                        <li>
                            <a class="nav-link" href="#CCC" data-toggle="tab">
                                CCC
                            </a>
                        </li>
                    </ul>
                </div>       
            </div>
        </div>
    </div>
</div>

Here is my custom CSS (all other CSS is Default Bootstrap 4):

.modal-header {
    background: #4a4a4a;
    padding: 0;
}

.tabs-top {
    margin-bottom: 1px;
    margin-top: 1px;
}

.nav-tabs {
    border: 0;
}

.tabs-4 .nav-tabs > li {
    width: 25%;
    border: 0;
}

.nav-tabs > li > a {
    width: 100%;
    border: 0;
    background: #4a4a4a;
    color: #fff;
    border-radius: 0;
    text-align: center;
}

.nav-tabs > li > a:hover, 
.nav-tabs > li.active > a, 
.nav-tabs > li.active > a:hover, 
.nav-tabs > li.active > a:focus {
    border: 0;
    background: #4a4a4a;
    color: #ffd800;
}

.nav-tabs > li.active > a {
    border: 0;
    background: #4a4a4a;
    color: #fff;
}

.nav-tabs > li.active > a.active {
    border: 0;
    background: #4a4a4a;
    color: #ffd800;
}

.nav-item {
    vertical-align:top;
}

Answer №1

If you want to decrease the padding of .modal-header, you can try the following:

.modal-header {
  padding: 0;
}

The default padding set by Bootstrap 4 for .modal-header is 1rem, as shown in their CSS file excerpt below:

.modal-header {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: start;
  align-items: flex-start;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  border-top-left-radius: 0.3rem;
  border-top-right-radius: 0.3rem;
}

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

Difficulties with Bootstrap, JQuery, HTML, and CSS

Currently in the process of revamping a university society's website, I have some experience in web development but nothing too advanced. You can view the current website here: . Here is a sneak peek at the new design I am working on: . However, I& ...

Arrangement priority and fixed location

Here is the issue I'm facing: f http://d.pr/i/Kge6+ I have three images positioned absolutely within a box that is fixed in position. I want the images to not overlay on top of each other, but despite trying various solutions (changing z-index, remo ...

You can tab through form input boxes on an Adobe Muse website, but they cannot be clicked

Lately, I created a small website using Adobe Muse and incorporated their form widget. However, I haven't altered any of the default settings and now the input boxes are not clickable. The only way to interact with them is by tabbing through. How can ...

Prevent the tab key from exiting the input field and instead direct it to a designated element on the webpage

I have customized a select menu for user interaction, but I am facing issues with normal keyboard behaviors not working as expected. Specifically, I want to enable tab functionality to navigate to my styled select menu just like when clicking tab to cycle ...

Inject the result.php file into a bootstrap modal using AJAX

Disclaimer: After searching through various stackoverflow posts within the last 3 days, I have not been able to find a precise answer to my question. Please read before providing a link to an already answered query. Issue I am facing a problem where the ...

Transfer the value of a JavaScript variable to paste it into a fresh tab on Google Chrome

I have come across some examples where users can copy HTML text to the clipboard. However, I am working on something more dynamic. Here's what I'm trying to achieve: <button id="" ng-click="outputFolder()">Output Folder</button> $sc ...

Encountered issue while submitting HTML form using POST method and jQuery

Here is the code for my form: <form id="ereserva" action="index.php" method="post"> <fieldset> <label for="id">ID</label> <input type="id" name="ei" id="eid" readonly class="id text ui-widget-content ui-corner ...

Tips for shortening your webpage for better mobile viewing

Looking to optimize my Login screen for mobile responsiveness. I am working on a project in ROR, so I have an html.erb file for the view: <body class="app flex-row align-items-center"> <div class="container"> <div class="row "> < ...

Troubleshooting techniques for resolving CSS issues with the video.js package in ReactJS

When using video.js in react to build a video player, I encountered an issue with the npm package not providing its inbuilt CSS. How can I add the inbuilt CSS of video.js? Instead of the control bar, I am getting something different than what is shown in t ...

Assistance required in publishing a website

Just finished coding my first website in HTML using Notepad. Now I'm wondering how to go about publishing it. Does DREAMWEAVER play a role in this process? Do I need it to upload the code to web hosting services or can I do it directly? And if so, how ...

Tips for retrieving the value when a button is clicked in AngularJS

Looking for assistance on retrieving the selected value in AngularJS when a button is clicked. Below is the code I am currently using: <div class="form-inline"> <div class="form-group"> <select class="form-control" data-n ...

Having trouble getting the equirectangular panorama example from Three.js to work on your device even though WebGL is supported?

After examining the WebGL equirectangular panorama example, it performs well on both desktop and mobile devices (such as the Samsung S4 Android 4.4.2) using the latest version of mobile Chrome. However, when tested on the Samsung tablet SM-T230 also runni ...

What are some ways to expand the width of a MaterialUI form control if no value has been chosen?

I am currently working on a project where I need a dropdown menu component with specific selections. However, the layout appears to be cramped and I'm struggling to adjust the width. Additionally, I've been unsuccessful in changing the font size ...

My website is currently experiencing issues with all of the CSS references not working. This problem applies to both external and internal CSS files and consistently

I'm encountering 404 errors when trying to load both internal and external files on a website through my browser. My code snippet looks like this: <link rel="stylesheet" type = "text/css" href='anoceanofsky.css'/> Despite clearing m ...

Troubleshooting problems with footer size in wkhtmltopdf

I am facing an issue while trying to convert an HTML file to a PDF format. Specifically, when attempting to include a footer, the size rendered in the PDF does not match the one specified in the CSS. The designated size for the footer should be exactly 15 ...

Can you set the line thickness for "text-decoration: line-through;" using CSS?

When it comes to the line-through property in CSS, the default weight of 1px is ideal for body copy set at 1em. However, for larger items like a price set at 3em on an offer site, 1px can feel too light. Is there a way to increase the line weight for line ...

What could be causing my jQuery click event to behave as if I triggered a click on the parent element?

I have created multiple child divs within a parent div. All the divs are positioned, with the parent div set to absolute and the child divs set to relative. The z-index of the parent div is 400, while the child divs have a z-index of 500. However, when I ...

In order to avoid conflicts, please update the version code of your APK as there is currently one with version code 1. How can I go about changing the version?

My attempt to upload an apk file on Google Play has hit a roadblock. The apk file was created using Unity3D. Google Play is giving me an error message stating that I need to use a different version code for my APK because a version with code 1 already exis ...

Show the table header at all times, even when the rows are hidden from view

Whenever the number of rows in my dynamic table changes due to user events, all tr elements that do not have the class .selected are set to display:none;. This means that at times, none of the table rows have the class selected. The problem arises when I h ...

Tips for achieving a unique look with CSS: Transforming border radius colors in four distinct sections

Is it possible to create a gradient border with multiple colors using border radius? div { border-radius: 30px; width: 60px; height: 60px; border: 1px red solid } Hello <div> </div> I am looking to achieve a unique effect on my bord ...