html - 如何制作垂直对齐文本的列表?

标签 html css twitter-bootstrap

我正在尝试使用垂直对齐的文本列出列表,但无论我尝试和搜索多少次,我都无法做到。那么,如何使用 twitter bootstrap 实现以下结果?!

                                   Ahmed: what's your name?
                                   Bob: ahmed
                                   Cate: ok!

目前我有这个,我似乎无法修复。

                              Ahmed: what's your name?
                                   Bob: ahmed
                                    Cate: ok!

HTML:

<div class="container-fluid" align="center">
    <div class="jumbotron">
        <ul style="list-style-type: none; vertical-align: middle;">

            <li><h5><strong>Ahmed and his friends</h5></li>
            <li><h5><strong>life is good</h5></li>

        </ul>

    </div>
</div>

最佳答案

你需要的是让你的 ul 标签在你的页面中间居中并且 li 左对齐

在 css 中,您可以尝试将元素右对齐:

ul {
  margin-left:35%;
}

li {
    text-align:left;
}

关于html - 如何制作垂直对齐文本的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37241541/

相关文章:

PHP <Style> 改变div的背景颜色

javascript - ajax jquery + bootstrap 模式仅在第二次单击时有效

html - 如何左/右对齐元素并调整垂直高度

html - 在移动设备上从右上到下引导网格

html - 在 div 中给出边框标题

google-chrome - 具有透明边框图像的背景颜色

php - 两列 ("gap") 布局问题

html - 减少 Bootstrap 中内容之间空间的最简洁方法

jquery - Bootstrap Center 水平对齐一个div

javascript - 用鼠标在网页上模拟震颤(例如帕金森病)?