The vertical space between the <li>

How to add vertical space between <li> elements (including display of blocks - block displays should have a difference between them)?

+4
source share
5 answers

I (like everyone else) are confused by what you ask. Would such a code be useful?

 ul { margin: 1em 0; padding: 0 0 0 40px; } li { margin: 1em 0; } 

Or is it more like that?

 ul { margin: 0; padding: 0 0 0 40px; } li { margin: 0; } li + li { margin-top: 1em; } 

This CSS assumes that you are using the ul ad li elements correctly as:

 <ul> <li>foo</li> <li>bar</li> <li>baz</li> </ul> 
+9
source

Try the following:

 li { margin-bottom: 10px; } 
+10
source

Set the CSS margin property for your <li> elements:

 li { margin-bottom: 1em; } 

eg. See http://jsfiddle.net/ubxvS/

+2
source
 .MyUl li { display: block; height: 20px; } 
0
source
 li { display: block; height: 20px; margin-bottom: 10px; } 
0
source

Source: https://habr.com/ru/post/1381783/


All Articles