Skip to main content

[CSS] 項目清單和內容對齊

keywords: list-item#
How to align list item and list content with space#

希望能夠建立一個像下圖這樣的項目清單:

img

解決方法如下:

body {  padding: 20px;}
ol {  list-style-type: upper-roman;  list-style-position: inside;}
li {  line-height: 20px;}
ol li span {  display: block;  padding-left: 30px;  margin-top: -20px;}

Demo code @ CodePen Question @ StackOverFlow