我可以移除子弹而不只是隐藏它们吗?

发布于 2025-01-17 07:16:49 字数 470 浏览 2 评论 0原文

当我使用代码 list-style: none;要删除子弹,看起来它只是隐藏它们,因为对齐偏离中心,就好像子弹只是看不见但仍然存在。如何使我的列表居中对齐?

此图显示了未隐藏的子弹。

此图片显示未隐藏的项目符号。

在此图像中,当我隐藏项目符号时,列表偏离中心,就好像项目符号不可见但仍然影响对齐。

在此图片,当我隐藏项目符号时,列表偏离中心,就好像项目符号不可见但仍然影响对齐。

When I use the code list-style: none; to remove the bullets, it appears it's just hiding them, because the alignment is off center as if the bullets are just invisible but still there. How can I make the alignment centered for my lists?

This image shows the bullets unhidden.

This image shows the bullets unhidden.

In this image, when I hide the bullets, the list is off center, as if the bullet is invisible but still affecting the alignment.

In this image, when I hide the bullets, the list is off center, as if the bullet is invisible but still affecting the alignment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感受沵的脚步 2025-01-24 07:16:49

您所要做的就是删除列表上的 padding-left

#list-2 {
  list-style: none;
}
#list-3 {
  list-style: none;
  padding-left: 0;
}
<ul id="list-1"> 
  <li>Foo</li>
  <li>Bar</li>
  <li>Baz</li>
</ul>
<ul id="list-2"> 
  <li>Foo</li>
  <li>Bar</li>
  <li>Baz</li>
</ul>
<ul id="list-3"> 
  <li>Foo</li>
  <li>Bar</li>
  <li>Baz</li>
</ul>

All you should have to do is remove the padding-left on the list.

#list-2 {
  list-style: none;
}
#list-3 {
  list-style: none;
  padding-left: 0;
}
<ul id="list-1"> 
  <li>Foo</li>
  <li>Bar</li>
  <li>Baz</li>
</ul>
<ul id="list-2"> 
  <li>Foo</li>
  <li>Bar</li>
  <li>Baz</li>
</ul>
<ul id="list-3"> 
  <li>Foo</li>
  <li>Bar</li>
  <li>Baz</li>
</ul>

懷念過去 2025-01-24 07:16:49

尝试将此代码与您的列表项类一起使用,它可能会工作并且会与中心对齐

display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
list-style: none;

Try this code with your list item class it might work and will aline to center

display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
list-style: none;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文