0

我试图让图标的底部与浏览器中的一些文本(到像素 - 第一个 S 的最低像素应该与文件夹图标的最低像素相同的高度)对齐,但 Chrome 是总是给我不同的结果。

小提琴:

http://jsfiddle.net/LrhB7/1/

HTML:

<div class="study-box set-box">
    <div class="set-box-title"> 
        <i class="icon-folder-close-alt">
        </i>
        <div>SHOULD BE LINED UP WITH BOTTOM OF FOLDER</div>
    </div>
</div>

CSS:

.study-box {
    width: 200px;
    height: 120px;
    margin: 2px;
    float: left;
    color: white;
    text-align: center;
    font-size: 15px;
    position: relative; }

.folder-box-title > div, .set-box-title > div {
    -ms-text-overflow: ellipsis !important;
    -o-text-overflow: ellipsis !important;
    text-overflow: ellipsis !important;
    white-space: nowrap;
    overflow-x: hidden;
    display: inline-block;
    text-align: justify;
    width: 162px !important;
    padding-bottom: 0px;
    margin-bottom: 0px;
    line-height: 20px;
    position: relative; }

.set-box-title {
    position: absolute;
    bottom: 0;
    left: 0;
    margin-left: 10px;
    padding-bottom: 7px; }
4

1 回答 1

1

这应该是您正在寻找的内容:http: //jsfiddle.net/W3WW7/1/

<div class="study-box set-box">
    <div class="set-box-title"> 
        <i class="icon icon-folder-close-alt">
        </i>
        <div>SHOULD BE LINED UP WITH BOTTOM OF FOLDER</div>
    </div>
</div>

改变:

.folder-box-title > div, .set-box-title > div {
    -ms-text-overflow: ellipsis !important;
    -o-text-overflow: ellipsis !important;
    text-overflow: ellipsis !important;
    white-space:nowrap;
    overflow-x:hidden;
    display: inline-block;
    text-align: justify;
    width: 162px !important;
    padding-bottom: 0px;
    margin-bottom: 0px;
    line-height: 20px;
    position: relative;
    top: 2px; // changed this line
}

添加:

.icon {
    vertical-align: text-bottom;
}
于 2013-07-16T02:17:08.417 回答