如何在不设置固定大小的情况下强制ul中的所有li元素与最大项目的大小相同?(How do you force all li elements in a ul to be the same size a

系统教程 行业动态 更新时间:2024-06-14 16:58:29
如何在不设置固定大小的情况下强制ul中的所有li元素与最大项目的大小相同?(How do you force all li elements in a ul to be the same size as the largest item without setting a fixed size?)

我有一个页面上的类别列表,每个类别都有一个嵌套的子类别列表。 类别列表项目样式以网格模式排列项目(通过display:inline; float:left ),其子类别以正常列表布局显示。 类别和子类别是用户配置的,但我不指望有数百个(可能不超过10个或20个子类别的3个或4个类别)。

我宁愿不为每个列表项目设置一个固定的大小。 我想围绕每个元素绘制边框,但是我不喜欢每个列表项大小基于其内容时的外观。 没有在列表项目上设置固定大小的解决方法吗?

I have a list of categories on a page, each with a nested list of subcategories. The category list item style arranges the items in a grid pattern (via display:inline; float:left), with the subcategories showing underneath in a normal list layout. The categories and subcategories are user configured, though I don't expect there to be hundreds (probably not more than 10 or 20 subcategories for each of 3 or 4 categories).

I would rather not set a fixed sized for each list item. I would like to draw a border around each element, but I don't like how it looks when each list item size is based on it's content. Is there a way around this without setting a fixed size on the list items?

最满意答案

你不能用CSS,你必须使用JavaScript。

You can't with css, you'd have to use javascript.

更多推荐

本文发布于:2023-04-15 03:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/8b954dba748f0c0a8ea295233aac694e.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大小   目的   大项   情况下   元素

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!