Indent List in HTML and CSS

后端 未结 7 1467
抹茶落季
抹茶落季 2021-02-05 04:17

I\'m new to CSS and working with list. I tried using one of the code I saw on w3schools which shows how to indent lists:




A n

7条回答
  •  太阳男子
    2021-02-05 05:01

    It sounds like some of your styles are being reset.

    By default in most browsers, uls and ols have margin and padding added to them.

    You can override this (and many do) by adding a line to your css like so

    ul, ol {  //THERE MAY BE OTHER ELEMENTS IN THE LIST
        margin:0;
        padding:0;
    }
    

    In this case, you would remove the element from this list or add a margin/padding back, like so

    ul{
        margin:1em;
    }
    

    Example: http://jsfiddle.net/jasongennaro/vbMbQ/1/

提交回复
热议问题