[英]How I center html “ul” element in bootstrap 4 (horizontal + vertical) inside <section><div class='row'><div class='col-sm'>
How to center html " ul " element in bootstrap4 (horizontal + vertical) with horizontal aligned " li "如何将 html“ ul ”元素在 bootstrap4(水平 + 垂直)中居中,水平对齐“ li ”
<section> <div class='row'> <div class='col-sm'> <ul> <li>A</li> <li>B</li> <li>C</li> </ul> </div> </div> </section>
If you use this code the list will be displayed in the center of the yellow box.如果您使用此代码,列表将显示在黄色框的中心。 I don't know why it won't work on the code preview on stackoverflow, but here you can see that it works.
我不知道为什么它在 stackoverflow 上的代码预览中不起作用,但在这里您可以看到它起作用。
<section> <div class='row'> <div class='col-sm' style="background-color: yellow; display:grid;height: 100%"> <ul style="margin: center;"> <li>A</li> <li>B</li> <li>C</li> </ul> </div> </div> </section>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.