views:

34

answers:

3

Basically I want to control the margin on the left of the list. Here's how I have it structured:

<li> 
<a href="http://link.com"&gt;Main&lt;/a&gt; 
<ul> 
    <li> 
        <a href="http://link.com"  title="">Sub1</a>
    </li> 
    <li> 
        <a href="http://link.com"  title="">Sub2</a> 
    </li> 
</ul>
</li>

The sub-sections are too far to the right with the current style I'm using. How do I change it?

A: 

You want to remove or at least lessen the margin/padding.

li ul { padding: 0; margin: 0 }
li ul li { padding: 0; margin: 0; }

This should make it flush with the main section list items, adjust to taste.

mark123
+1  A: 

My ul "reset" looks something like this:

ul { list-style-type: none; margin: 0; padding: 0 }
Pekka
Thanks, that did the trick!
Mike42
A: 

You need to add class attribute to the sublist:

<li> 
<a href="http://link.com"&gt;Main&lt;/a&gt; 
<ul class="sublist"> 
    <li> 
        <a href="http://link.com"  title="">Sub1</a>
    </li> 
    <li> 
        <a href="http://link.com"  title="">Sub2</a> 
    </li> 
</ul>
</li>

And put this css for it:

ul.sublist{
   margin-left:20px;
}
craftsman