Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Need help with list spacing.

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #45428
    jameswoo
    Member

    Hi,
    new here. Hope to get some help with spacing within a list.

    The list on this website http://legalwillsmalaysia.com/ (the one with blue checks & red crosses) have a spacing between each bullet point that is too large & I can’t figure how to reduce this spacing. The normal list that comes after that are spaced nicely.

    Here’s the CodePen. Hope I got this right too http://cdpn.io/gvkso

    Any help much appreciated. Tq

    #138206
    David_Leitch
    Participant

    To fix the problem, I just added margin: 0 and list-item: none to the ul tag. Forked [here](http://codepen.io/David_Leitch/pen/JhDcohttp://codepen.io/David_Leitch/pen/JhDco”)

    #138207
    Paulie_D
    Member

    Seems like there’s a lot of unnecessary stuff going on in there:

    `list-style-image` would seem to be a better option: http://codepen.io/Paulie-D/pen/IqpeA

    #138262
    jameswoo
    Member

    Paulie_D

    thanks for your suggestion. I used your code & cleared up a bunch of unnecessary stuff. But I still can’t get the line spacing a bit smaller via css.

    present code here http://cdpn.io/GlEoc

    Using firebug, I found it seem to inherit a bottom margin setting of 23px (1.5em i think) from the elsewhere. I can use

    to get result in the first 2 bullet points as an example but when I include at margin-bottom in the css below, it does not work.

    .include_list li p {
    margin-bottom: 8px;
    }

    Btw, I have to include the

    or everything goes wonky on my site.

    Thanks. I’m totally noob at this.

    #138263
    chrisburton
    Participant

    You need to remove the `p` tags from your list-item. They’re not needed.

    http://codepen.io/seraphzz/pen/ucGBo

    > or everything goes wonky on my site

    You’re probably making a mistake somewhere. Would help if you updated your code with what I have and then we can fix the issues.

    #138266
    rawat3209
    Participant

    Hey you can fix or adjust the spacing with the line-height property

    #138277
    chrisburton
    Participant

    @rawat3209 Keep in mind that’s not what line-height is for. He will run into problems when text enters a new line. Margin or Padding is best.

    Confusing: http://codepen.io/seraphzz/pen/mCazo

    Optimal: http://codepen.io/seraphzz/pen/htecD

    #138280
    jameswoo
    Member

    @chrisburton

    thanks, your code worked great. I reckon the p tag got inherited from the main stylesheet with a margin-bottom of 1.5em. Thanks a lot for everyone chipping in.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.