How to suppress left and right space of a Slider widget?

Hi every one,

I’ve just discover this forum, and a forum on Jupyter community should be a really nice place. That’s why I’m new here.

I already have a question… I’d like to suppress the left and right space around a Slider interactive Jupiter widget in the GUI I’m currently working on. But, apparently, my CSS is not good enough…

Here is a code snippet:

        import ipywidgets as widgets
        f = widgets.FloatSlider(value=0, min=-10, max=10, 
                                description='f =',
                                layout=Layout(border='solid 1px blue')
                               )

I get the following output:
Capture d’écran 2020-05-12 à 17.14.53
while I’d want to have something without so much space on the left border or right border

If anyone has idea, I’d really appreciate help.

You can change the overall width in the layout option (see https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Styling.html), or you can change the description_width (the width of the label on the left) with a style option (see https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Styling.html#Description)

1 Like

Thanks Jasongrout. This was helpful