CSS help required for unordered list

Discussion in 'CSS' started by jawednazarali, Oct 25, 2006.

  1. #1
    I got two unordered list in the following fashion:
    
    <ul>
       <li>My links
          <ul>
              <li>My First site link</li>
              <li>My Second Site Link</li>
          </ul>
       </li>
    </ul>
    
    Code (markup):
    I want this to be displayed like this

    My links
    • My First Site Link
    • My Second Site Link

    Instead of this:
    • My links

    • My First Site Link
    • My Second Site Link

    Does any one has suggestions to control it using CSS?
     
    jawednazarali, Oct 25, 2006 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    
    li {
    list-style-type: none;
    }
    
    li li {
    list-style-type: disc;
    }
    
    Code (markup):
     
    SoKickIt, Oct 25, 2006 IP
    jawednazarali likes this.
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    
    ul {
        list-style: none;
        margin: 0;   /*removes default indention from IE & Opera*/
        padding: 0; /*removes default indention from Moz & Safari*/
        }
    
    ul ul {
        margin-left: 40px; /*adds indention to nested ul*/
        list-style: disc;
        }
    Code (markup):
    cheers,

    gary
     
    kk5st, Oct 25, 2006 IP
  4. jawednazarali

    jawednazarali Guest

    Messages:
    254
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks a lot guys;

    by the way how can I make a div to occupy the all the rest of the empty space available.

    I have sidebar and main content area sometimes when contets grow the side bar remains to its length that also depends upon the no. of links in it.

    I want to control the height of the side bar and main content area; no matter which ever div grows they both grow in equal height.

    any suggestions?
     
    jawednazarali, Oct 25, 2006 IP
  5. jascele

    jascele Peon

    Messages:
    48
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    jascele, Oct 25, 2006 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    You're thinking like a print designer. The web is not print. It is nearly always a bad idea to think in terms of controlling height. The web page is as long as it needs to be. It is print that has finite dimensions.

    For an example of a web based version of what you want, see http://garyblue.port5.com/webdev/2col.html

    cheers,

    gary
     
    kk5st, Oct 25, 2006 IP