python - 短划线范围 slider ,两侧都有输入

标签 python html css plotly-dash rangeslider

我对前端开发和 HTML 还很陌生,我很难理解
在使用 Dash 时如何在同一行中订购具有两个输入的范围 slider

我尝试过分离html.Div
将组件放在同一个Div中而不分离它们
调整不同的参数等等
但我仍然无法让它按我想要的方式显示

我想要什么:
enter image description here

我有:
enter image description here

我的代码(重现我所拥有的):

import dash
import dash_core_components as dcc
import dash_html_components as html

app.layout = html.Div([
    html.Div([
        html.Div([dcc.Input(
            id='slider-min-value',
            placeholder=str(min_value))],
            style={'width': '10%'}
        ),
        html.Div([dcc.RangeSlider(
            id='condition-range-slider',
            min=0,
            max=30,
            value=[10, 15],
            allowCross=False)],
            style={'width': '25%'}
        ),
        html.Div([dcc.Input(
            id='slider-max-value',
            placeholder=str(max_value))],
            style={'width': '10%'}
        ),
        ],
        style={'display': 'inline-block'})])

if __name__ == '__main__':
    app.run_server(debug=True)


我需要做什么才能让范围 slider 和输入按我想要的方式显示?

最佳答案

好的,使用 {"display": "grid", "grid-template-columns": "10% 40% 10%"} 给了我我想要的。
布局:

app.layout = html.Div(
    html.Div(
        [
            dcc.Input(type='text', value=min_value),
            dcc.RangeSlider(
                id='condition-range-slider',
                min=0,
                max=30,
                value=[10, 15],
                allowCross=False
            ),
            dcc.Input(type='text', value=max_value)
        ],
        style={"display": "grid", "grid-template-columns": "10% 40% 10%"}),
    style={'width': '20%'}
)


我得到了什么:
enter image description here

关于python - 短划线范围 slider ,两侧都有输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61896144/

相关文章:

python - 给定总和的最短子集和 Python 中最快的解决方案

javascript - 使用 <a> 标签加载 Ajax 页面

css - Laravel 5.6 Bootstrap Jumbotron 背景图片

javascript - 将 DIV 几何形状固定到浏览器 100% 除了其他元素

结合for循环和if语句的Pythonic方式

python - 带有列表的列中按字符串的 pandas df 子集

html - 停止 CSS 层次结构

css - “text-decoration” 和 “:after” 伪元素,重访

python - PyTorch 中未知的 Python 语法 : a instance can directly receive a parameter

jquery - 设置 Canvas 元素的尺寸