Indent List in HTML and CSS

后端 未结 7 1478
抹茶落季
抹茶落季 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:07

    You can use [Adjacent sibling combinators] as described in the W3 CSS Selectors Recommendation1 So you can use a + sign (or even a ~ tilde) apply a padding to the nested ul tag, as you described in your question and you'll get the result you need. I also think what you want it to override the main css, locally. You can do this:

    <style>
        li+ul {padding-left: 20px;}
    </style>
    

    This way the inner ul will be nested including the bullets of the li elements. I wish this was helpful! =)

    0 讨论(0)
提交回复
热议问题