holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.77k stars 519 forks source link

Ability to specify height/width as a percentage #1296

Open analog-cbarber opened 4 years ago

analog-cbarber commented 4 years ago

Currently you can only either specify the width and height in terms of absolute number of pixels or min/max.

CSS supports height/width specified as a percentage of the space in its container. It would be nice if there was some way to use this through layout parameters.

Not sure what the workaround is. I guess I could use css_classes to apply some pre-canned percentages, but haven't tried it yet...

philippjfr commented 3 years ago

Given Bokeh's layout manager this is currently not possible, however Bokeh plans to switch to an unmanaged (CSS-based) layout for 2.0 at which point this should be supported. See https://github.com/bokeh/bokeh/wiki/CSS-Layout-Design for more details.

awesomebytes commented 4 months ago

Hello, I ended up here from a different issue: my PDF pane was not using all the available space. I cannot know the screen size of users, so defining the size in px was not the best option for me. I found out I could use sizing_mode as documented here.

pn.pane.PDF('http://localhost:5006/mypdf.pdf', sizing_mode="stretch_both")

Kind of unrelated to this issue, but, I cannot just give the PDF file path to render it, I need to provide a http/https url or I get a "missing schema" error.