带有缩进的动态填充的嵌套列表 [英] Nested lists with indenting dynamic paddings

查看:65
本文介绍了带有缩进的动态填充的嵌套列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看看我在js bin上的代码示例: http://jsbin.com/iritep/3/edit

Take a look at my code example at js bin: http://jsbin.com/iritep/3/edit

我想在不继续使用我的硬编码css-rule的情况下缩进黄色项:

I'd like to indent the yellow colored item without continuing my hard coded css-rule:

ul li a {padding-left: 20px;}
ul li ul li a {padding-left: 40px;}
ul li ul li ul li a {padding-left: 60px;}
ul li ul li ul li ul li a {padding-left: 80px;}   /* don't want this line! */

是否可以使CSS更加动态,而不必添加CSS的最后一行?

Can I possibly make this css more dynamic without having to add the last line of css?

推荐答案

很抱歉,Stackoverflow不允许我在这么短的时间内发表两次评论.这是解决我的问题的链接.

I'm sorry, Stackoverflow didn't allow me to comment twice in such short notice. Here is the link to the solution to my problem.

http://jsbin.com/iritep/5/edit#javascript, html,live

这篇关于带有缩进的动态填充的嵌套列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆