What is the best way to ensure smooth and consistent tabs using CSS?

After implementing a UI with 4 tabs, I noticed that the gap between the tabs is inconsistent. When attempting to set the width to auto, the indicator below the tabs does not display properly.

Here is the code for the tabs:

<div class="MuiTabs-flexContainer" role="tablist">
    <button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit Mui-selected" tabindex="0"   type="button" role="tab" aria-selected="true">
        <span class="MuiTab-wrapper">Aikika</span>
        <span class="MuiTouchRipple-root"></span>
    </button>
    <button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit" tabindex="-1" type="button" role="tab" aria-selected="false">
        <span class="MuiTab-wrapper">Qwertyuio</span>
        <span class="MuiTouchRipple-root"></span>
        </button>
    <button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit" tabindex="-1" type="button" role="tab" aria-selected="false">
        <span class="MuiTab-wrapper">Plmojnuhbtf</span>
        <span class="MuiTouchRipple-root"></span>
        </button>
    <button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit" tabindex="-1" type="button" role="tab" aria-selected="false">
        <span class="MuiTab-wrapper">Tokjl Test</span>
        <span class="MuiTouchRipple-root"></span>
    </button>
</div>

And here is the code for the indicator (the underline below the tab):

<span class="jss3 jss5 MuiTabs-indicator jss1" style="left: 0px; width: 120px;"></span>

The CSS code for the tabs is:

.MuiTabs-flexContainer button {
    min-width: 120px;
    font-weight: 100;
    margin-top: 8px;
}

And the CSS code for the indicator is:

.jss1 {
    height: 3px;
    background-color: #09728e;
}

Although everything is currently working fine, I am aiming to make the gap between the tabs consistent and ensure the indicator functions correctly. Screenshots have been attached for reference - The red box highlights the gap between tabs, while the blue line indicates the indicator below the tabs.

https://i.sstatic.net/q21VD.png

https://i.sstatic.net/9hnTh.png

Answer №1

Here's a possible solution you could attempt:

.CustomTabs-container{
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

CSS: Inject Text at the End of Input Text's Value

Hey there, I'm facing a minor issue. The user wants to add some funny text to an input field if a specific condition is met. For example: Normal Condition: the input field shows "#{model.user}" Abnormal condition: the input field should display "# ...

What is the best way to center images horizontally in CSS and HTML?

I'm looking to create a driver's page where the desktop view displays images horizontally instead of vertically. I've tried adjusting the display attribute with limited success, and so far, the grid display is the closest I've come to a ...

Utilizing SVG background images with Trigger.io on Android devices running version 4.4

Android 4.4 is currently experiencing issues displaying SVG background images when loaded as local resources. However, loading them from a remote URL seems to display them without any problems. ...

Using CSS to modify the image source property through media queries

Currently working on an HTML5 application for Android, iPhone, and Windows phone. Utilizing media queries to showcase different image files based on screen width. When displaying the image through the CSS background-image property, I can alter the image f ...

Using React and Material UI to create a table filtering system with checkboxes

I'm currently developing a filtering feature using checkboxes for a data display in a project utilizing React and Material-UI. Is there a custom solution available within Material-UI? If not, what steps should I take to achieve this? As I am rel ...

How can you call a function in JavaScript based on a condition?

Is there a way to conditionally truncate text using a function called Truncate only when the offsetHeight of the left div with class demo is greater than the offsetHeight of the right div? If this condition is not met, then simply return the original conte ...

The Functions of Span and Div Elements

I am facing an issue with the code below, where I am trying to align the menu bar (page-wrap) in the same line as the content. The following two lines are used for star rating and displaying the stars. <div id="content" float: left></div> ...

The Bootstrap dropdown menu unexpectedly appears in front of the panel located above

Having trouble with the Bootstrap dropdown panel. My web page has 4 main panels, each containing additional bootstrap panels. When I open one panel at a time, everything works fine. However, when I try to open multiple panels simultaneously, the positions ...

Troubleshooting a Button Problem with CSS in Twitter Bootstrap

Here is the original source (with problem) However, when attempting to replicate the issue in jsfiddle, I am getting the correct result What could be causing this discrepancy? How can I resolve this issue? ...

focusing on a single div amidst a sea of interwoven dynamically generated divs

I am currently working with the liferay framework and I am facing a challenge where I need to apply inline JavaScript to target a very specific div on my webpage. The catch is that this div is nested within multiple dynamically added divs with varying clas ...

Struggling to close the dropdown with jquery

Check out this code snippet: https://jsfiddle.net/rajat_bansal/rtapaew5/1/ The jQuery section below is causing some trouble: $(document).ready(function(e) { $(".sub-handle").click(function() { if(!$(this).hasClass('showing-sub&ap ...

Mastering the Art of Line Breaks in WordPress

I am looking for a way to break a WordPress site title over two lines at a specific point in the text. Since the WordPress content filter 'wpautop' disables the ` ` tag (also known as ` ` or ` `), I'm wondering what the best alternative ...

Injecting CSS styles into dynamically inserted DOM elements

Utilizing Javascript, I am injecting several DOM elements into the page. Currently, I can successfully inject a single DOM element and apply CSS styling to it: var $e = $('<div id="header"></div>'); $('body').append($e); $ ...

Modifying Style Attributes using Javascript

Upon entering the index page, I have a navigation menu that directs me to every page on the website. Once I click and access a specific page, everything appears perfectly. Navigation Code in index.html <nav class="masthead-menu" id="masthead-menu"& ...

Certain browsers have difficulty running CSS keyframes animations

As I work on my website, I have integrated a CSS keyframes animation that is triggered by clicking a link connected to a JavaScript function. Here is an excerpt from my CSS file: #banner { background-color: #00BBD2; position: absolute; width: 100%; heigh ...

Using CSS files that are not properly imported into React components

Currently, I am utilizing multiple CSS files for a specific purpose. The issue I am facing is that when I apply styles to one component in a CSS file, it inadvertently affects other components as well, not just the intended one. I believe the root of this ...

Guide to setting up a horizontal button menu and dropdown submenu beneath the navigation bar using Bootstrap 4

How can I design a horizontal button menu with submenus below the navigation bar in Bootstrap 4? Take a look at the image below to see what I'm aiming for: https://i.sstatic.net/j6b8a.png https://i.sstatic.net/rmtrM.png If you have any ideas or su ...

Guide to positioning a close icon in the top right corner of a div with a scroll bar

I'm trying to customize my modal box by adding a close button at the top right, slightly outside of the box. I found an example of what I want here: https://i.sstatic.net/7FsjB.png (Taken from this site) The CSS code to add the cross at the top righ ...

Guide to setting a white background color specifically for a lightbox in Angular

I want to change the background-color to white for my gallery items. Currently, I am using the following code to open the full-screen view: this.lightbox.open(0, 'lightbox1', { panelClass: 'fullscreen'}) Can someone please guide me on ...

Troubleshooting: Issues with material-ui component properties functionality

One issue I am facing is that most properties of the Menu component are not functioning properly. For example, the onChange property does not work when I click on the MenuItem. However, the onClick function works as expected. I am having trouble figuring ...