Beginning of a line. UL and LI

Discussion in 'CSS' started by Lindsey2002, Nov 7, 2007.

  1. #1
    Hey,

    Is there a way to specify in the CSS file that every UL or LI line should begin 30px from the left.

    I know that there is a function for a box, but is there any way to make it happen to an LI or UL without actually putting them in a box?

    Thanks.
     
    Lindsey2002, Nov 7, 2007 IP
  2. Crimsonc

    Crimsonc Peon

    Messages:
    616
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    give the li's the following (if i understand you correctly)

    margin-left: 30px;
     
    Crimsonc, Nov 21, 2007 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To do that though you're going to have to zero out the padding as well since different browsers use different properties to indent lists.
     
    Dan Schulz, Nov 21, 2007 IP
  4. Crimsonc

    Crimsonc Peon

    Messages:
    616
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    sure, use the wildcard reset

    * {padding: 0; margin: 0;}
     
    Crimsonc, Nov 21, 2007 IP
  5. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That can actually cause a lot of usabililty and accessibility problems with form controls. I'd use this instead (at the very top of the stylesheet).

    
    html, body, address, blockquote, div, dl, form, h1, h2, h3, h4, h5, h6, ol, p, pre, table, ul,
    dd, dt, li, tbody, td, tfoot, th, thead, tr, button, del, ins, map, object,
    a, abbr, acronym, b, bdo, big, br, cite, code, dfn, em, i, img, kbd, q, samp, small, span,
    strong, sub, sup, tt, var {
    	margin: 0;
    	padding: 0;
    }
    
    Code (markup):
     
    Dan Schulz, Nov 21, 2007 IP
  6. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #6
    You've got my attention with that one, I've never heard of that before.

    What kind of problems ?
     
    joebert, Nov 22, 2007 IP
  7. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It can be harder for people who navigate via the keyboard to retain focus of the controls, other browsers will not let you reapply margins or padding to form controls that have had them zeroed out via the universal selector, and Internet Explorer in particular will flat out ignore it on certain form controls under specific circumstances.

    I'd give you more, but the source I'd like to cite is down right now.
     
    Dan Schulz, Nov 22, 2007 IP
  8. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Wait, okay, what's a control? I've been using that stupid star since I first heard about its wonders and glories, and of course always need to add padding here and margins there on stuff inside my forms (giving my obese CSS sheets an extra weight problem) and so far I see the effects of these paddings and margins... and so far it looks like I can focus on the labels, input and dropdown boxes with the down arrow... what am I missing?

    It would be nice if CSS had an "exception" rule so that you didn't have to bloat your zeroing with a huge paragraph of every possible element known to man. * !form {margin:0;padding0;}

    Guess I'll add that to my CSS wishlist for Sinterklaas, along with UNIX/bash rules, regular expressions, some basic math, vertical centering inside elements... sigh.
     
    Stomme poes, Nov 22, 2007 IP
  9. panki

    panki Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    If you want to be applied in all li's and ul's you can write something like that in your stylesheet

    ul, li { margin: 0 0 0 30px;}
     
    panki, Nov 22, 2007 IP
  10. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Stomme, a form control is an element found inside the FORM element. Input, select/option, textarea, and so forth.
     
    Dan Schulz, Nov 22, 2007 IP