Casso77
Casso77

Reputation: 41

trying to align images in a div

Ok, so now I have my boxes all sorted, I would like to try and align an image and some text next to a picture. I would like the text to go at the top and the email logo to go at the bottom as seen on below image

element alignment

#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>

Upvotes: 1

Views: 167

Answers (1)

Robert Koritnik
Robert Koritnik

Reputation: 105019

I have created a JSFiddle with dummy images, that displays information the way that your image shows. Or close to what you want/need.

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); }
​
​

Upvotes: 1

Related Questions