开发者

Center li number of a ol list

I have a ol list. This list is fill with li that contains text that can be on multiple line. What I want to do is to center the number that mark the position in the list.

Ex:

<ol>
   <li>
       Text in multiple line
   </li>
</ol>

Will do :

开发者_如何转开发
  1. Text in
     multiple line

The '1' in the previous example is the thing that I want to position at the middle center. Is it possible. If yes, how can I do that.


I think this may be what you're looking for:

<style>
    li span {
        display: inline-block;
        vertical-align: middle;
    }
</style>

<ol>
    <li>
      <span>Text in <br />multiple lines</span>
    </li>
    <li>
      <span>Text in one line</span>
    </li>
</ol>


Use

<ol>
<li>Text in </br>multiple line</li>
</ol>

fiddle


If your list element should come to center try this

<ol>
   <li style="text-align:center;">
       Text in multiple line
   </li>
</ol>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜