【问题标题】:How to align the card image to centre in Plotly Dash Bootstrap Component?如何在 Plotly Dash Bootstrap 组件中将卡片图像对齐到中心?
【发布时间】:2021-01-11 10:46:07
【问题描述】:

有没有办法让 dbc.card 图像在 Plotly Dash Bootstrap 中居中对齐?我浏览了文档,我只能找到“顶部”和“底部”。谢谢。下面是代码sn-p:

import dash_bootstrap_components as dbc
import dash_html_components as HTML
card = dbc.Card(
[
    dbc.CardImg(src="/static/images/placeholder286x180.png", top=True),
    dbc.CardBody(
        [
            html.H4("Card title", className="card-title"),
            html.P(
                "Some quick example text to build on the card title and "
                "make up the bulk of the card's content.",
                className="card-text",
            ),
            dbc.Button("Go somewhere", color="primary"),
        ]
    ),
],
style={"width": "18rem"},)

【问题讨论】:

    标签: plotly-dash plotly-python


    【解决方案1】:

    需要解决同样的问题,这是我使用Bootstrap cheatsheet发现的:

    dbc.CardImg(src="/static/images/placeholder286x180.png", className = 'align-self-center')
    

    我是新手,所以它可能不是最正确的,但它对我有用。

    【讨论】:

      猜你喜欢
      • 2019-12-12
      • 1970-01-01
      • 2022-07-01
      • 2023-03-22
      • 2020-09-30
      • 1970-01-01
      • 2022-11-01
      • 2021-12-27
      • 1970-01-01
      相关资源
      最近更新 更多