# Advice on setting width of the slider to cm or inches

**URL:** <https://discourse.processing.org/t/advice-on-setting-width-of-the-slider-to-cm-or-inches/21118>\
**Category:** Coding Questions\
**Created:** [May 20, 2020, 11:08pm UTC](https://discourse.processing.org/t/advice-on-setting-width-of-the-slider-to-cm-or-inches/21118 "2020-05-20T23:08:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cperezl](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@cperezl](https://discourse.processing.org/u/cperezl)\
**Post date:** [May 20, 2020, 11:08pm UTC](https://discourse.processing.org/t/advice-on-setting-width-of-the-slider-to-cm-or-inches/21118/1 "2020-05-20T23:08:41Z")

</div>

Hi everyone,

I have a very basic understanding of p5.js and I am working on a program using sliders for a psychological experiment. The sliders will be used to answer questions on a scale from “nothing” to “a lot”. When doing this in paper-form , the subjects mark their response with a pencil on a line of width 10 cm. My problem is how to set-up the width of the slider so it is always a fixed length (i.e. 10 cm) independent of the resolution of the screen. Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Sven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sven/32/8293_2.png) [@Sven](https://discourse.processing.org/u/Sven)\
**Post date:** [May 22, 2020, 5:05pm UTC](https://discourse.processing.org/t/advice-on-setting-width-of-the-slider-to-cm-or-inches/21118/2 "2020-05-22T17:05:00Z")

</div>

Hello @cperezl

You can use CSS (Cascading Style Sheets) to give an absolute length to your slider. One possible solution:

```auto
let slider = createSlider(0, 10);
slider.style('width', '10cm');

```

There could be potential problems, though. Absolute sizing is often avoided on the web. As an example, if you’re thinking about supporting smartphones, there’s a lot of screens out there less than 10 cm wide.
