How to reduce the vertical space above and below a ul list with one command?
-
PROBLEM: How to reduce the vertical space above and below a ul list without having to define different classes according to the objects before and after the list? That is, is it possibile to reduce the space of a fixed quantity using only one class regardless of the objects above and below the list?
This is the default vertical spacing in a wordpress list (code on left, output on right)
I think that the spacing is too much, so I would like to reduce it and I find out that I have to modify the top and bottom
margin
of theul
list. I experimented a bit and I think the default values for spacing are1em
top and bottom. The strange thing is that when decreasing from1em
to0em
nothing happens, so I had to go negative and find out that a good value is-0.5em
Then I tried the same but with
div
instead of textThis time the vertical space already changes when decreasing from
1em
to0em
, so to decrease as much as in the previous case, I had to set a value of0.5em
. By futher decreasing to-0.5em
the vertical spacing is reduced too much.So in the case of a
div
before the list and text after the list (and viceversa), two differentmargin
values have to be set in order to have equal spacing above and belowAnd maybe there are other types of objects which needs different
margin
values.I was hoping I could set globablly the vertical spacing of the list, without having to define different classes and manually set the correct class each time I have to use a list.
Am I doing something wrong or is this how the job has to be done? Isn’t there a way to set globally the space and don’t have to worry every time a list has to be used?
- The topic ‘How to reduce the vertical space above and below a ul list with one command?’ is closed to new replies.