html - 内联列表项框在包含中断词时向上移动

标签 html css html-lists

enter image description here

正如您在图片中看到的,Reference Check 正在向上移动,因为 Reference Check 标签已损坏。

CSS

  .candidate-listing-sources {
         display: inline-block;
         border: 1px solid grey;
         width: 100px;
         height: 75px;
         padding-top: 5px;
         margin-right: 2px;
     }

HTML 我正在使用 Angular JS

<ul>
    <li class="candidate-listing-sources text-center"
        ng-repeat="source in candidateListingSources" 
        ng-click="loadCandidateListing(source.type)">
        <span>{{::source.label}}</span><br />
        <img ng-if="source.count === null" 
             ng-src="{{iconsUrl + '/loading.gif'}}" />
        <span ng-if="source.count !== null" class="badge">{{source.count}}</span>
    </li>
</ul>

在空白测试页面中完成呈现的 HTML

        <style type="text/css">
            .candidate-listing-sources {
                display: inline-block;
                border: 1px solid grey;
                width: 100px;
                height: 75px;
                padding-top: 5px;
                margin-right: 2px;
            }
        </style>
        <ul>
            <li class="candidate-listing-sources text-center">
                <span>Sourced</span><br>
                <span class="badge">0</span>
            </li>
            <li class="candidate-listing-sources text-center">
                <span>Breaking Words </span><br>
                <span class="badge">0</span>
            </li>
            <li class="candidate-listing-sources text-center">
                <span>OneWord</span><br>
                <span class="badge">0</span>
            </li>
        </ul>

最佳答案

向 CSS 添加 vertical-align:middle(或所需值):

.candidate-listing-sources {
                display: inline-block;
                border: 1px solid grey;
                width: 100px;
                height: 75px;
                padding-top: 5px;
                margin-right: 2px;
       vertical-align:middle;
            }

演示:http://jsfiddle.net/gane8foL/

附言希望它能与 bootstrap CSS 一起工作(不确定整个 CSS 上下文)。

关于html - 内联列表项框在包含中断词时向上移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32749534/

相关文章:

JQuery Mobile - 内联显示 HTML 表单

html - HTML 表格中的 rowspan 和 colspan 问题

php - 将 HTML 表数据添加到 MySQL 数据库中

javascript - 新创建的 UL LI 元素上的单击事件

html - 为什么 <hr/> 有一个奇怪的黑色顶部边框?

html - 将列表添加到列表项

javascript - 从引导导航栏链接中删除事件类

css - 移动菜单覆盖

html - 分层 CSS SVG 蒙版不起作用

javascript - 如何在不更改其他属性的情况下更改 ul 中 li 的文本?