如何使用HTML / CSS创建居中有序列表? [英] How to create centered ordered list with HTML/CSS?

查看:446
本文介绍了如何使用HTML / CSS创建居中有序列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要创建一个简单的排序列表,如下所示:

I'd like to create a simple centered ordered list like the following:


    1. one
   2. three
  3. fifteen
    4. two

我所做的一切都使得数字向左对齐,而不是停留在项目旁边的右边。如何获得上述结果?

Everything I'm trying makes the number align flush to the left, rather than stay to the right next to the item. How do I get the result above?

推荐答案

使用

<style type="text/css">
 .centered { text-align: center; list-style-position:inside;}
</style>    

<ol class="centered">
  <li>one</li>
  <li>three</li>
  <li>fifteen</li>
  <li>two</li>
</ol>

这篇关于如何使用HTML / CSS创建居中有序列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆