html - css,居中两位数 <li>

标签 html css

我有

<ul id="list">
  <li> 
     <a href=''>1</a>
  </li>
  <li>
     <a href=''>2</a>
  </li>
  <li>
     <a href=''>3</a>
  </li>
  <li>
      <a href=''>4</a>
  </li>
  ...
  <li>
      <a href=''>10</a>
  </li>
  <li>
      <a href=''>11</a>
  </li>
</ul>

风格看起来像:

enter image description here

我希望两位数像个位数一样居中。我试过(分别):

#list li{
  text-align: center;
  align-items: stretch; // and center
  margin-left: auto; //with margin right the same
  left: 0;
}

但似乎没有什么能解决这个问题

最佳答案

将文本对齐设置为:

#list li a{
  text-align: center;
}

关于html - css,居中两位数 <li>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27901788/

相关文章:

html - 合并所有 bootstrap js 和 css 文件?

jquery - 最大高度不起作用

java - 使用Jsoup提取特定的html表格内容

html - 如何使该网格适合初始窗口大小,但允许用户缩放? (无 react )

css 下拉菜单消失在内容后面

javascript - 如何将答案分组到 JavaScript 类别中?

html - 图像在 HTML 中对齐

css - Firefox 的行高

css - Bootstrap 固定 div(宽度增加到 100%)

html - SVG 折线渐变仅适用于笔划