1

好的,所以现在我的盒子都整理好了,我想尝试将图像和图片旁边的一些文本对齐。我希望文本位于顶部,电子邮件徽标位于底部,如下图所示

元素对齐

#nav1 {
    width: 1000px;
    height: 100px;
    background-color: #F90;
}

#pic {
    width: 200px;
    height: 67px;
    margin-top: 15px;
    float: right;
    margin-right: 15px;
}

<div id="container">
    <div id="nav1">
        <div id="pic">
            <img src="email.png" />
            <img src="photo.jpg" align="right" />
        </div>
    </div>
</div>
4

1 回答 1

1

我创建了一个带有虚拟图像的JSFiddle,它以图像显示的方式显示信息。或接近您想要/需要的。

HTML

<div class="user">
    <img class="avatar" src="http://lorempixel.com/64/64/people"/>    
    <div class="name">Mahatma Gandhi</div>
    <div class="people">6</div>
    <div class="emails">1</div>
</div>​

CSS

.user
{
    background-color: #ebebee;
    display: inline-block;
    padding: 5px;
    text-align: right;
}
.avatar {
    float: right;
    margin-left: 6px;
}
.name
{
    height: 48px;
    font-size: 1.25em;
    text-align: right;
    white-space: nowrap;
    margin-right: 70px;
}
.people, .emails
{
    height: 16px;
    display: inline-block;
    margin-right: 10px;
    padding-left: 20px;
    background-position: left top;
    background-repeat: no-repeat;
}
.people { background-image: url(http://lorempixel.com/16/16/1); }
.emails { background-image: url(http://lorempixel.com/16/16/2); }
​
​
于 2012-10-10T13:42:05.510 回答