2012-08-16 188 views
1

在我的HTML文档我有一个嵌套列表风格:边框样式

li { 
    list-style-type:none; 
    border:1px solid; 
    margin:3px; 
} 

li li { 
    list-style:none; 

} 


<ul> 
    <li>something 
    <ul> 
     <li>hello</li> 
     <li>there</li> 
    </ul> 
    </li> 
</ul> 

以我目前的CSS规则边框看起来是这样的:

enter image description here

我希望他们看起来像这样,但没有插入<span>标签:

enter image description here

有什么建议吗?

+2

看起来你将需要一个'span'标签。我试了几种方法无济于事... – Purag 2012-08-16 16:59:23

+2

加'宽度:40px'或类似的东西 – jcho360 2012-08-16 16:59:43

+0

@ jcho360,你的意思是'高度:40px'?我认为这将起作用! – janeh 2012-08-16 17:04:27

回答

1

也许这样的事情:

li { 
    clear: both; 
    width: 200px; 
    list-style-type:none; 
    border:1px solid; 
    margin:3px; 
} 
li ul{ 
    float: left; 
} 


<ul> 
    <li>something 
    <ul> 
     <li>hello</li> 
     <li>there</li> 
    </ul> 
    </li> 
    <li>something 
    <ul> 
     <li>hello</li> 
     <li>there</li> 
    </ul> 
    </li> 
</ul> 

结果:

enter image description here