gpt4 book ai didi

javascript - 如何在 css 中获取页面宽度。

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

如何在 css 中获取页面宽度。获取窗口宽度/高度很容易。例如:Height: 100% 将高度设置为窗口高度的 100%。我想将它设置为页面大小的 100%。因为如果我们在使用窗口大小时进行缩放,那么它采用的最大尺寸就是窗口。

最佳答案

jquery 可以给你一个解决方案如下:

$(window).height();   // returns height of browser viewport
$(document).height(); // returns height of HTML document

所以你可以使用$(document).height();

关于javascript - 如何在 css 中获取页面宽度。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19427714/

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