How to use CSS to control the style of an HTML unordered list?


Tags: html,css,html-lists

Problem :

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?



Solution :

My ul "reset" looks something like this:

ul { list-style-type: none; margin: 0; padding: 0 }

    CSS Howto..

    How can I have a CSS hover affect a different tag?

    How to remove the space between list items [duplicate]

    how to create table grid view fix header with long title name using only CSS?

    How do I evenly space these links within my navbar div?

    CSS Select element, how to disappear the arrow?

    How to eliminate the margin of div boxes

    How to make a div inside a div while keeping same image background

    how to detect a url path with jquery and change css

    Centering Special Javascript Popup, How?

    How to blend canvas to background with CSS?

    PhoneGap: How to get iPad specific CSS to work?

    How do you choose when to use DIV and when SPAN, to wrap something?

    How to position two divs horizontally within another div

    CSS property padding-top only works on the first element of a list. How do I apply to all the elements?

    How to change angularJS's default css styles? Search box etc

    css: how to make
    not highlighted when selecting text (in Chrome)

    How to position iframe (calendar) inside php echo statement?

    how to change css of n number of div element using jquery

    How do I find out which style is overriding another style?

    CSS: how to apply styles to the last of a CSS class (not the last of )

    How to make objects move with CSS?

    How to apply CSS style when ID is taken?

    How to ensure that columns are contained within a row

    How to auto-resize tabs to fit a fixed-width container?

    How to make jQuery add css dynamaically on window resize

    OS X is messing with me css, how to fix

    How to center a rotated div inside a table element with a specific width?

    How to position two images in opposite corners of one div

    CSS Flexbox : How to construct a specific layout

    How to perfectly center contents in an unordered list?