4
二元我有一個簡單的ul
元素具有較大的高度,我想在ul
元素的底部最後兩個li
元素和休息之上。在長個兒的UI元素如何在底部
你可以看到當前的實現here。
代碼是這樣的:
.my-ul {
height: 90vh;
width: 40%;
background-color: grey;
}
<div id="demo">
<ul class="my-ul">
<li>First Element</li>
<li>Second Element</li>
<li>Third Element</li>
<li>Fourth Element</li>
<li>Fifth Element</li>
</ul>
</div>
我試圖從here和here解決方案,但這些都是not working。
小提琴鏈接:http:// jsfiddle.net/gj0tb2fq/ – KiranPurbey
'n-last-child'會更好,因爲你可能不確定有多少列表項。 –
是的,對於較大的項目列表,使用「nth-last-child」更爲正確。 – KiranPurbey