set all nested li's to be width of widest li

后端 未结 6 1628
情书的邮戳
情书的邮戳 2021-01-13 21:30

How do I make nested li\'s the same width?

When I use the below code each nested li is only as wide as it\'s text + margin.

I\'d like all of the li\'s to be

6条回答
  •  走了就别回头了
    2021-01-13 21:41

    To make all of the list items the same length as the longest, you will need to manually set the widths. There is no pure CSS method of achieving this automatically as far as I know.

    li{width:100%} Will make the list items fill the width of their container. If that is not set, then it will be the width of the user's browser window.

提交回复
热议问题