gpt4 book ai didi

html - 根据屏幕大小限制表格行数

转载 作者:太空宇宙 更新时间:2023-11-04 07:01:41 25 4
gpt4 key购买 nike

所以,我在一个集合中有 n 个对象。我正在使用 ng-repeat<tr> .

有没有办法限制它在 html 中生成的行数,使表格不超过当前屏幕高度?

最佳答案

你可以尝试这样的事情:

您可以获得创建表格的元素的高度。假设高度是300px
你可以得到表格行的高度(<td>),比如说30px

现在可以在屏幕上显示的 № of rows 将是 300/30 = 10 (包括标题)。

所以你可以在 $index == 10 上使用 ng-if (使用 ng-repeat)。

The values will change as per your screen size.

关于html - 根据屏幕大小限制表格行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51980232/

25 4 0
文章推荐: css - background-color: transparent 在 Safari 和 IE11 浏览器中显示为 background-color: #0000
文章推荐: java - 反序列化对象时出现 EOFException
文章推荐: java - 使用信号量进行流量同步
文章推荐: html - 使
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com