标签和破折号组件并排 [英] label and dash component side by side

查看:71
本文介绍了标签和破折号组件并排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Dash.我想做的一件事是并排放置一个标签和滑块.下面的代码呈现这个.我该怎么做代码才能让滑块标签和滑块并排显示.谢谢.

I am using Dash. One of the thing I want to do is have a label and slider side by side. The following code render this. What can I do the the code so that the slider label and the slider shows up side by side. Thanks.

                                    html.Div(
                                    [
                                        html.Label("First Slider"),
                                        dcc.RangeSlider(
                                            id="my-range-slider",
                                            # label="Slider 1",
                                            min=0,
                                            step=0.01,
                                            max=1,
                                            value=[0.2, 0.8],
                                            marks={0: "0", 1: "1"},
                                            allowCross=False,
                                        ),
                                    ],
                                    className="rows",
                                ),
                                html.Div(
                                    [
                                        html.Label("Second Slider"),
                                        dcc.RangeSlider(
                                            id="my-range-slider1",
                                            # label="Slider 1",
                                            min=0,
                                            step=0.01,
                                            max=1,
                                            value=[0.2, 0.8],
                                            marks={0: "0", 1: "1"},
                                            allowCross=False,
                                        ),
                                    ],
                                    className="rows",
                                ),

推荐答案

Flexbox 可以轻松完成.让每个包含的 div 都有 style=dict(display='flex'),并确保有足够的水平空间.

Flexbox will get that done easily. Make each of the containing divs have style=dict(display='flex'), and just make sure there's enough horizontal room.

这篇关于标签和破折号组件并排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆