【问题标题】:Icon does not align well with text in Chrome图标与 Chrome 中的文本不能很好地对齐
【发布时间】:2013-07-16 13:01:14
【问题描述】:

我试图让图标的底部与浏览器中的一些文本对齐(到像素 - 第一个 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; }

【问题讨论】:

    标签: html css google-chrome


    【解决方案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;
    }
    

    【讨论】:

    • 感谢斯宾塞。该文件夹仍然没有与文本对齐......它高出几个像素。我不知道如何将它们与像素对齐。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-24
    • 1970-01-01
    • 1970-01-01
    • 2021-06-22
    • 2011-03-07
    • 2020-01-07
    相关资源
    最近更新 更多