gpt4 book ai didi

How to put list bullet points to center(如何将列表项目符号放在中心位置)

转载 作者:bug小助手 更新时间:2023-10-25 19:29:40 25 4
gpt4 key购买 nike



I was just practicing how to code in html and I'm having a difficult time finding a way to put the bullet points of lists in HTMLI.

我只是在练习如何用html编写代码,我很难找到一种方法来把列表的要点放在htmli中。


so here is a sample of an ordered list that I did. When I tried using "center" and "list-style-position: center" it worked only on the text but it didn't affect the bullets. BTW I'm doing this in notepad++. Is there a way to achieve this with only using notepad++?

这里有一个我做的有序列表的样本。当我尝试使用“CENTER”和“LIST-STYLE-POSITION:CENTER”时,它只对文本起作用,但对项目符号没有影响。顺便说一句,我是用记事本++做这件事的。有没有办法只使用记事本++就能做到这一点?


<ol>
<li>fish</li>
<li>eggs</li>
<li><font face="arial" color="magenta">beefy</font></li>
<li>chicken</li>
<li>pork</li>
</ol>

更多回答
优秀答案推荐

There is a way to solve this by either using inline CSS in the HTML or by external CSS file.

有一种方法可以通过在HTML中使用内联css或通过外部css文件来解决此问题。


Solution: The HTML code will remain as is and just adding some style to ol tag:

解决方案:HTML代码将保持不变,只是在ol标记中添加一些样式:




ol {
text-align: center;
padding-left: 0;
list-style-position: inside;
}

<ol>
<li>fish</li>
<li>eggs</li>
<li><font face="arial" color="magenta">beefy</font></li>
<li>chicken</li>
<li>pork</li>
</ol>




Explanation: The given solution answers the issue as:

说明:给出的解决方案回答了这个问题:



  1. text-align: center - style helps to center the text in the list

  2. padding-left: 0 - removes the default padding of the list

  3. list-style-position: inside - centers the bullet points (or numbers) with the list items


Maintaining these style rules, you can easily put bullet points in center for both ordered and unordered list. This will solve your problem.

维护这些样式规则,您可以轻松地将项目符号放在有序和无序列表的中心。这会解决你的问题。


更多回答

25 4 0