SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I remove initial space at top of list?

    Say I have a list like this:


    BKD provides a wide range of consulting services to help you focus on the future: Internal auditing

    - Internal control assessments
    - Technology security controls
    - Fraud prevention
    - Enterprise integrity

    Html puts this really huge space inbetween non-list text, and the list itself. Can I use css to remove that space?

  2. #2
    011521 dbalsdon's Avatar
    Join Date
    Feb 2003
    Location
    North Of Scotland
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use margin-top:0.. add it to the <ul> tag so..

    <ul style="margin-top:0;">
    <li>List Item 1</li>
    <li>ect..</li>
    </ul>

    edit:
    if you want to remove the margin from the bottom of the list aswell.. just use margin-bottom:0; aswell...
    Daniel Balsdon
    My Site

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by lucas
    Can I use css to remove that space?
    Yes you can! Here's the code:
    Code:
    ul {
      margin: 0px;
      padding: 0px;
    }
    And here's the explanation:

    Opera and IE use margins to give the space around lists. Gecko-based browsers like Mozilla and Netscape use padding to create that space. By setting both to 0 you get around the inconsistencies of those three browsers. More information about styling lists can be had here:
    http://www.alistapart.com/stories/taminglists/

  4. #4
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't get this to work in IE 6.0

  5. #5
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also turn margins and padding off on the thing directly before the list.

    also make sure that you have atleast well-formed HTML.

    Douglas
    Hello World


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •