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">Main</a> 
<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?

3 Answers 3

1

My ul "reset" looks something like this:

ul { list-style-type: none; margin: 0; padding: 0 }
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

0

You need to add class attribute to the sublist:

<li> 
<a href="http://link.com">Main</a> 
<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;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.