gpt4 book ai didi

java - 如何将自定义 ScrollPanel 的高度设置为 100%?

转载 作者:行者123 更新时间:2023-11-28 11:20:14 25 4
gpt4 key购买 nike

我想设置一个CustomScrollPanel到高度 100%;我尝试的是让 CustomScrollPanel 达到 100% 的高度,但它并没有那样工作。这是我尝试过的。

public class MyScrollPanel extends Composite implements HasWidgets {

private ResizeLayoutPanel resizeLayoutPanel;
private CustomScrollPanel customScrollPanel;


public MyScrollPanel() {
resizeLayoutPanel = new ResizeLayoutPanel();
resizeLayoutPanel.setStyleName(resources.css().resizeLayoutPanel());
customScrollPanel = new CustomScrollPanel();
customScrollPanel.addStyleName(resources.css().customScrollPanel());


resizeLayoutPanel.add(customScrollPanel);
initWidget(resizeLayoutPanel);
}

我的CSS:

.resizeLayoutPanel {
height: 100%;
background-color: yellow;
}

如何让 CustomScrollPanel 的高度达到 100%?

最佳答案

height:100% 将不起作用,除非父 div 具有固定高度,如 height:500px

最好的方法是计算窗口/父容器的高度并将其分配给您的 div 元素,并在运行时使用调整大小条件。

关于java - 如何将自定义 ScrollPanel 的高度设置为 100%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21577990/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com