Space around <li> tags...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Voodoo
    ♥ ♦ ♣ ♠
    • Sep 2002
    • 10600

    #1

    Space around <li> tags...

    I had a link a while back that told how to get rid of the space around the [li] tags in CSS. Can't seem to find it now. Anyone know how?

    "I'm selflessly supporting the common good, but only coincidentally looking out for No.1."
  • FlexxAeon
    Confirmed User
    • May 2003
    • 3765

    #2
    Code:
    ul li { margin: 0; }
    or it might be padding i can't remember. try both
    Last edited by FlexxAeon; 09-09-2009, 08:08 PM.
    flexx [dot] aeon [at] gmail

    Comment

    • Voodoo
      ♥ ♦ ♣ ♠
      • Sep 2002
      • 10600

      #3
      Originally posted by FlexxAeon
      Code:
      ul li { margin: 0; }
      or it might be padding i can't remember. try both
      Yeah, I use:
      Code:
      *{margin:0px;padding:0px;}
      At the top, but have also tried it on the actual element. The padding is still there. ;-/

      "I'm selflessly supporting the common good, but only coincidentally looking out for No.1."

      Comment

      • Darkland
        Confirmed User
        • May 2002
        • 1488

        #4
        Code:
        <ul style="margin: 0;">
          <li>knklnlkn</li>
          <li>lknlonln</li>
        </ul>
        That what you are looking for?


        "The towers are gone now, reduced to bloody rubble, along with all hopes for Peace in Our Time, in the United States or any other country. Make no mistake about it: We are At War now -- with somebody -- and we will stay At War with that mysterious Enemy for the rest of our lives." H.S.T. 09/12/01

        Comment

        • FlexxAeon
          Confirmed User
          • May 2003
          • 3765

          #5
          Originally posted by Darkland
          Code:
          <ul style="margin: 0;">
            <li>knklnlkn</li>
            <li>lknlonln</li>
          </ul>
          That what you are looking for?
          wait do you put it on the ul? i'm blanking. dont make me open dreamweaver
          flexx [dot] aeon [at] gmail

          Comment

          • ProG
            Confirmed User
            • Apr 2009
            • 1319

            #6
            What is inside the li?

            If there is an image inside, try using li img { display: block; }

            If there is only text and the padding is top & bottom adjust li { line-height: 1em; }

            Or are you referring to bullet spacing?
            History will be kind to me for I intend to write it.

            Comment

            • ungratefulninja
              Confirmed User
              • Apr 2006
              • 682

              #7
              Margin and padding do control the space inside and outside of the LI "box."

              If you're wanting to control the space between the bullet point and the text then { text-indent: 0pt;} or something along those lines will do it.

              Comment

              • Darkland
                Confirmed User
                • May 2002
                • 1488

                #8
                Originally posted by FlexxAeon
                wait do you put it on the ul? i'm blanking. dont make me open dreamweaver
                Worked for me...


                "The towers are gone now, reduced to bloody rubble, along with all hopes for Peace in Our Time, in the United States or any other country. Make no mistake about it: We are At War now -- with somebody -- and we will stay At War with that mysterious Enemy for the rest of our lives." H.S.T. 09/12/01

                Comment

                • TheSenator
                  Too lazy to set a custom title
                  • Feb 2003
                  • 13330

                  #9
                  Your gonna have to ask a CSS expert.

                  There is a short hand way of doing this that will work for IE and FIreFox.


                  Im looking for a mod done to my WordPress theme that a CSS expert did for me. It was kinda of the same thing.
                  ISeekGirls.com since 2005

                  Comment

                  • Basic_man
                    Programming King Pin
                    • Oct 2003
                    • 27360

                    #10
                    Originally posted by TheSenator
                    Your gonna have to ask a CSS expert.

                    There is a short hand way of doing this that will work for IE and FIreFox.


                    Im looking for a mod done to my WordPress theme that a CSS expert did for me. It was kinda of the same thing.
                    Hit me up on ICQ (349-164-75) if you need a CSS mod done
                    UUGallery Builder - automated photo/video gallery plugin for Wordpress!
                    Stop looking! Checkout Naked Hosting, online since 1999 !

                    Comment

                    • FlexxAeon
                      Confirmed User
                      • May 2003
                      • 3765

                      #11
                      Originally posted by Darkland
                      Worked for me...
                      sigh.. had to open the dreamweaver

                      you're right but padding gets rid of the "indentation" while margin gets rid of the space between the ul and the li

                      so to get rid of all space it would be

                      Code:
                      <ul style="margin: 0; padding: 0;">
                        <li>knklnlkn</li>
                        <li>lknlonln</li>
                      </ul>
                      no css expert necessary
                      flexx [dot] aeon [at] gmail

                      Comment

                      • Lycanthrope
                        Confirmed User
                        • Jan 2004
                        • 4517

                        #12
                        You will alleviate a lot of aggravation by one simple change when you are first zeroing things out:

                        change

                        Code:
                        * {margin:0px; padding:0px;}
                        to

                        Code:
                        * {margin:0; padding:0;}

                        Comment

                        • ProG
                          Confirmed User
                          • Apr 2009
                          • 1319

                          #13
                          0 and 0px are the same thing - that is strictly a preference and makes no difference.

                          http://www.w3.org/TR/CSS2/syndata.html#length-units

                          The format of a length value (denoted by <length> in this specification) is a <number> (with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.). After a zero length, the unit identifier is optional.
                          History will be kind to me for I intend to write it.

                          Comment

                          • Miguel T
                            ♦ Web Developer ♦
                            • May 2005
                            • 12470

                            #14
                            ul { margin: 0; padding: 0}
                            ul li { display: block; width: 100%; }

                            Test that out.

                            Full Stack Webdeveloper: HTML5/CSS3, jQuery, AJAX, ElevatedX, NATS, MechBunny, Wordpress

                            Comment

                            Working...