Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align list item to the left in unordered list

Tags:

html

css

I have the following html and css:

HTML:

<div id="wrapper">
  <ul>
    <li>li1</li>
    <li>li2</li>
  </ul>
</div>

CSS:

#wrapper
{
}

#wrapper ul
{
    width:50px;
    height:100px;
    border-style:solid;
    border-width:1px;
    list-style-type:none;
}

#wrapper ul li
{
    border-style:solid;
    border-width:1px;   
}

Which results in the following unordered list:

How do I align the list-items to the left in the unordered list?

I've tried float and margin in the "#wrapper ul li", but that doesn't solve the problem..

like image 849
Birdman Avatar asked Feb 02 '12 11:02

Birdman


2 Answers

Your unordered list markers need to be put outside:

#wrapper ul {
    list-style-type: none;
    list-style-position: outside;
}
like image 86
onof Avatar answered Oct 18 '22 13:10

onof


Add a padding-left: 0pt to the #wrapper ul block:

#wrapper ul
{
    width:50px;
    height:100px;
    border-style:solid;
    border-width:1px;
    list-style-type:none;
    ' CHECK THE NEXT LINE '
    padding-left: 0pt;
}
like image 25
Rohan Prabhu Avatar answered Oct 18 '22 14:10

Rohan Prabhu