How would I ...

Discussion in 'CSS' started by dem0x7, Feb 1, 2010.

  1. #1
    Hi guys,

    I am in the process of coding a design into CSS, and everything is going well, no problems except for one question that I have.

    http://cintrexmedia.com/order/skin/frontend/default/default/images/new/orderlist.jpg

    How would I go about breaking that up into CSS?
    The actual list is easy, of course, I have everything down except for the numbers 1-3 on the left.

    I have that all coded, except I have the <ol> plain text, 1. 2. 3. and what I want to do is replace that with the spiced up version in the image above, while keeping the positioning right.

    Any ideas?

    Thanks a lot :)
     
    dem0x7, Feb 1, 2010 IP
  2. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use CSS to hid the normal numbers, get rid of the padding/margin on the ol element. Add left padding to the li elements and give them each a class. Set your styled numbers as a background image, and you're done!

    <ol>
    <li class="one">Item One</li>
    <li class="two">Item One</li>
    <li class="three">Item One</li>
    </ol>

    That should get you started!
     
    pmek, Feb 1, 2010 IP
  3. kooldesigning

    kooldesigning Greenhorn

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    In the forum you just mentioned class one, two, three but did not show the code of the three classes.
    Can you show a CSS code of class one, two and three.
     
    kooldesigning, Feb 1, 2010 IP
  4. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can do, often times it's more rewarding when you figure it out for yourself. Give me some time and I'll see what I can do.
     
    pmek, Feb 1, 2010 IP
  5. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I've attached a basic way of doing what you want.
     

    Attached Files:

    pmek, Feb 1, 2010 IP
  6. Anicho

    Anicho Member

    Messages:
    54
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #6
    pmkey isn't <ul> not <ol>?
     
    Anicho, Feb 1, 2010 IP
  7. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    No, this is an Ordered List (ol). That means that the list is in order, and is intended to be numbered. If it didn't matter what order the list was in, then you would use ul (unordered list). There is also something called a definition list - which is also very useful.
     
    pmek, Feb 1, 2010 IP
  8. dem0x7

    dem0x7 Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Wow, thank you so much for your help.

    I really appreciate it, and I learned something new :)
     
    dem0x7, Feb 1, 2010 IP
  9. dem0x7

    dem0x7 Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Just one quick question: When I add a border-bottom to the li CSS, it starts all the way from the image, so it look's a little odd, is there a way to modify it a bit to start the bottom border when the text starts?
     
    dem0x7, Feb 1, 2010 IP
  10. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Yeah, that's a problem I ran into.

    One way to do it would be to wrap your text in the li in p or span tags, then set that to have the border. Or just have the line stretch all the way across, but add padding to the li element so it doesn't touch the image.
     
    pmek, Feb 1, 2010 IP
  11. dem0x7

    dem0x7 Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Hmm, I tried both ways but they didn't turn out quite right. I'll continue to play around with it a bit!
     
    dem0x7, Feb 1, 2010 IP
  12. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Here you go, change the css to this:

    @charset "UTF-8";
    /* CSS Document */
    
    ol {margin:0; padding:0; list-style-type:none; font:12px/1.4 Verdana, Geneva, sans-serif;}
    
    li {margin:0 0 10px 0; padding:0 0 0 40px; display:block; width:250px;}
    
    li span {display:block; height:27px; padding:7px 0 8px 0; border-bottom:1px solid #ccc;}
    
    li.one {background:transparent url(one.gif) no-repeat 0 0;}
    li.two {background:transparent url(two.gif) no-repeat 0 0;}
    li.three {background:transparent url(three.gif) no-repeat 0 0;}
    Code (markup):
    And change the html to:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title>Untitled Document</title>
    </head>
    <body>
    <ol>
      <li class="one"><span>Item One</span></li>
      <li class="two"><span>Item One</span></li>
      <li class="three"><span>Item One</span></li>
    </ol>
    </body>
    </html>
    
    Code (markup):
    Then you should be good to go! you can change that span to a p, or an a, just make sure you change the css to match.
     
    pmek, Feb 1, 2010 IP
  13. dem0x7

    dem0x7 Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Excellent! You have been awesome, looks exactly like I wanted it to.

    Cheers ;)
     
    dem0x7, Feb 1, 2010 IP
  14. pmek

    pmek Guest

    Messages:
    101
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Good stuff. Glad I could help.
     
    pmek, Feb 1, 2010 IP
  15. kooldesigning

    kooldesigning Greenhorn

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #15
    I really appreciate for the code you sent.

    Best of luck
     
    kooldesigning, Feb 7, 2010 IP