How would you achieve this text layout in HTML/CSS without lists? -


required layout aligned hanging indents

edit/apology: forgot has done without lists.

curious how achieve layout in included image in html/css without using lists. reason it's legal document , list dotpoints have same paper document, i.e. have (a), can't a) or a. can't 100% trust browser render <ol type="a"> way expect.

note there more 1 space between numbered/lettered dotpoints , start of paragraph text, , later lines of hanging indents should line left-hand edge of paragraph text.

i can type of layout using &nbsp; force spacing, think of cheating. have manually adjusted had two-digit numbers.

anyone got ideas?

updated: must accommodate lots of text (wrapping margin). use divs custom css counters , :before psuedo-element:

html

<div class="outer-list">   <div>thing 1   </div>   <div>thing 2   </div>   <div class="inner-list">     <div>subthing 2.1     </div>     <div>subthing 2.2 lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl       ut aliquip ex ea commodo consequat. duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis @ vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum       zzril delenit augue duis dolore te feugait nulla facilisi. nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. typi non habent claritatem insitam; est usus legentis in iis qui       facit eorum claritatem. investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. mirum est notare quam littera gothica, quam nunc putamus       parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.     </div>     <div>subthing 2.3     </div>     <div>subthing 2.4     </div>     <div>subthing 2.5     </div>   </div>   <div>thing 3   </div>   <div>thing 4   </div>  </div> 

css

updated: use absolute positioning on :before elements place them outside margin.

.outer-list {   margin-left: 0;   padding-left: 0;   counter-reset: my-clever-counter; }  .outer-list > div {   margin-bottom: 1rem; }  .outer-list > div:not(.inner-list):before {   display: inline-block;   margin-right: 1rem;   content: counter(my-clever-counter);   counter-increment: my-clever-counter; }  .inner-list {   margin-left: 0;   padding-left: 0; }  .inner-list > div {   margin-left: 0rem;   padding-left: 3rem; } .inner-list > div:before {   margin:0;   position:absolute;   left:1.4rem; } .inner-list > div:nth-child(1):before {   content: "(a)"; }  .inner-list > div:nth-child(2):before {   content: "(b)"; }  .inner-list > div:nth-child(3):before {   content: "(c)"; }  .inner-list > div:nth-child(4):before {   content: "(d)"; }  .inner-list > div:nth-child(5):before {   content: "(e)"; } 

see updated codepen example


Comments