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.Divs 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
RowandColinside aContainer. A singleContainerwrapping your entire app’s content is fine. Setfluid=Trueif you don’t want the margins thatContaineradds 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
Rowcomponent should always beColcomponents. Your content should go inside theColcomponents.
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.
