我有一個無序列表中的項目清單,需要放置在彼此相鄰塊...對齊列表項中的UL
我的小提琴:
HTML
<ul id="selected-plays">
<li>Comedies</li>
<ul>
<li><a href="/asyoulikeit/">As You Like It</a></li>
<li>All's Well That Ends Well</li>
<li>A Midsummer Night's Dream</li>
<li>Twelfth Night</li>
</ul>
<li>Tragedies</li>
<ul>
<li><a href="hamlet.pdf">Hamlet</a></li>
<li>Macbeth</li>
<li>Romeo and Juliet</li>
</ul>
<li>Histories</li>
<ul>
<li>Henry IV (<a href="mailto:[email protected]">email</a>)
<ul>
<li>Part I</li>
<li>Part II</li>
</ul>
</li>
<li><a href="http://www.shakespeare.co.uk/henryv.htm">Henry V</a></li>
<li>Richard II</li>
</ul>
</ul>
CSS
#selected-plays > li {
float:left;
list-style:none;
margin:10px;
}
我需要將列表項相鄰放置..
你的HTML標記是無效的,驗證它http://validator.w3.org/#validate_by_input –
不要關閉'li'有'ul'子菜單,直到'ul'關閉。 http://jsfiddle.net/Paulie_D/hZSz5/6/ –