Tabs Style Colors

Hi all,

I’m having this tabs with target text color : white, for all tabs

and i want when a user hover the background would change to white and text color to grey for example,
because whenever i tried as the documentation suggested it over-write the first style i set

Screenshot 2023-04-09 114548

Thank you

1 Like

HI @Manar you could use CSS for that. An example:

import dash
from dash import html

app = dash.Dash(__name__)
app.layout = html.Div(
    'some random text, div changes background color and text color on hover',
    style={'height': '600px'}

if __name__ == '__main__':, port=8051)

in your custom css file in the assets foler:

.div_hover {
  background-color: blue;
  color: white;

.div_hover:hover {
  background-color: white;
  color: black;
  transition: background-color 0.5s ease;

The transition is not necessary, it’s more a question of personal preference. More info (for example) here


mred css


THANKS , it worked just fine when applied the class to dash attribute :
tabClassName=‘div_hover’ ,

Glad it worked. You can rename div_hover to whatever you want, just make sure you change the name in the css file too.