根据 JS 中的数量调整菜单项的大小
我需要一个菜单,其中的项目根据项目数量自行调整大小。比如说,有三项。每个宽度大约为容器的 33%。但如果有十个人,每个人都有 10%。有人有什么想法/建议吗?谢谢!
I need to have a menu that has items that size themselves based on how many there are. Say, there are three items. Each one would have about 33% width of the container. But if there were were ten, each would have 10%. Does anyone have any ideas/suggestions? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常菜单是从无序列表构建的,父菜单元素的 id="menu"
在这种情况下,您将需要如下代码:
Usually menu is built from unordered list and parent menu element have id="menu"
In this case you'll need code like next: