简体   繁体   English

<li> ,项目符号列表当前未排队

[英]<li>, bullet list not line up currently

On my website I have a bullet list with links. 在我的网站上,我有一个带有链接的项目符号列表。

The problem is when a link is a little long, it's split into two lines. 问题是当链接有点长时,它将分为两行。 It's fine! 没关系!

However, when it divides in two lines, the second line is not located below the other. 但是,当它分为两行时,第二行不位于另一行之下。

How can I move the second line to the right so it fit with the other links? 如何将第二行移至右侧,使其与其他链接匹配?

<div class="test"> 
  <ul>
    <li><a href="menuItem.html">Yes</a></li>
    <li><a href="menuItem.html">Yes Yes Yes Yes</a></li>
    <li><a href="menuItem.html">Yes</a></li>
  </ul>
</div>

Here is an image of what I'm describing 这是我正在描述的图像

在这里查看Buletimage

I'm guessing your list-style-position is set to inside . 我猜你的list-style-position设置为inside

You should set it to outside (and play with the margin-left attribute if you want to keep the left offset). 您应该将其设置为outside (如果要保持左偏移,请使用margin-left属性)。

See jsFiddle here 在这里查看jsFiddle

You could use the table layout: 您可以使用表格布局:

ol {
    counter-reset: foo;
    display: table;
}

ol > li {
    counter-increment: foo;
    display: table-row;
}

ol > li::before {
    content: counter(foo) ".";
    display: table-cell; /* aha! */
    text-align: right;
}

source: How to keep indent for second line in ordered lists via CSS? 来源: 如何通过CSS在有序列表中缩进第二行?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM