It’s probably because of how you have multiple divs and multiple cols.
If I style one row with col and div, it works.
import dash_bootstrap_components as dbc
from dash import Dash, html, dcc
import plotly.express as px
df = px.data.tips()
app = Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = dbc.Container([
dbc.Row([
dbc.Col([
dbc.Row([dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
# style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
# style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
# style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
# style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],),
dbc.Col([
html.Div(
children=["This is very long text."],
#style={"overflow-x": "auto", "white-space": "nowrap"}
# or
# style = {"white-space": "nowrap"}
),
],)
],
)
], width=12)
], style={"overflow-x": "auto", "white-space": "nowrap"}),
html.Div("Applying horizontal scroll style to Row with one dbc.Col:", className='my-5'),
dbc.Row([
dbc.Col([
html.Div(children=["This is very long text. This is very long text. This is very long text. This is very long text. This is very long text."
"This is very long text. This is very long text. This is very long text. This is very long text. This is very long text."])
], width=12)
], style={"overflow-x": "auto", "white-space": "nowrap"})
],fluid=False
)
if __name__ == "__main__":
app.run_server(debug=True)