CSS counter on hidden submenu

家住魔仙堡 提交于 2019-12-01 22:47:26
Harry

You can mimick the display: none (hidden) behavior by setting the font-size to 0px and this would make the element be counted by the counter property.

.hidden{
    font-size: 0px;
}

Demo


Or, a bit more complex version of the above (mentioned by Hashem Qolami in comments)

.hidden{
    font: 0/0 a; 
    visibility: hidden;
}

Demo 2


Note: visibility: hidden would also work but it would leave a space equivalent to the height of one line in the output.

Demo using Visibility Property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!