It seems like html.Div
is not always needed, especially if building your layout with the bootstrap grid system (dbc.Row
and dbc.Col
). Besides CSS styling and layout arrangement, when is html.Div
needed?
Hi @nlyle,
As far as I understand it, dbc.Row
and dbc.Col
are just html.Div
s with some extra pre-defined properties. You can learn more by opening the dev tools in your web browser when visiting some dash app (see example below).
In principle, you can combine dbc.Row
, dbc.Col
and html.Div
, but note this quote from the
- Only use
Row
andCol
inside aContainer
. A singleContainer
wrapping your entire app’s content is fine. Setfluid=True
if you don’t want the margins thatContainer
adds by default. Since the content of this page is wrapped with aContainer
, the snippets below don’t explicitly include them.- The immediate children of any
Row
component should always beCol
components. Your content should go inside theCol
components.
You can definitely place html.Div
inside of dbc.Col
if you have such need.
3 Likes
Thanks @sislvacl ! Since my local testing was working with just Containers, Rows, and Cols, it seemed like I didn’t need Div. Thanks for confirming with this example. Maybe sometimes an empty Div with an ID is good for being a callback output placeholder.