# A workaround for \`width\_policy="fit"\` + \`sizing\_mode="stretch\_width"\`

**URL:** <https://discourse.holoviz.org/t/a-workaround-for-width-policy-fit-sizing-mode-stretch-width/5822>\
**Category:** Showcase\
**Tags:** panel\
**Created:** [August 2, 2023, 4:54pm UTC](https://discourse.holoviz.org/t/a-workaround-for-width-policy-fit-sizing-mode-stretch-width/5822 "2023-08-02T16:54:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahuang11](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/ahuang11/32/4947_2.png) [@ahuang11](https://discourse.holoviz.org/u/ahuang11)\
**Post date:** [August 2, 2023, 4:54pm UTC](https://discourse.holoviz.org/t/a-workaround-for-width-policy-fit-sizing-mode-stretch-width/5822/1 "2023-08-02T16:54:13Z")

</div>

Since I don’t think width\_policy is functional (I could be wrong), if you have `pn.extension(sizing_mode="stretch_width")` but…

1. don’t want a component to stretch
2. don’t want to set a fixed width + height
3. don’t want to encounter these warnings when setting `sizing_mode="fixed"`: `(FIXED_SIZING_MODE): 'fixed' sizing mode requires width and height to be set: HTML(id='p1194', ...)`

Use `stylesheets` or `styles`:  
`styles=dict(width="fit-content")`

Before:

 ![image](https://discourse.holoviz.org/uploads/default/original/2X/1/1b8afae75e68b0a7fb9ca3fb0546d19100d3c8a2.png)

After:

 ![image](https://discourse.holoviz.org/uploads/default/original/2X/8/8b70f361bb20dfd076814f5fb80a8145923c949e.png)
