You can use this HTML markup:
<div class="profile">
<img src="path/to/your/img.png" alt="Example's Avatar" />
<p class="login-info">You are logged in as: <span class="username">Example User</span></p>
<ul class="user-info">
<li>Gender: Male</li>
<li>Age: 24</li>
<li>Member since: 24 Aug 2009</li>
<li>Currently wearing: Pink T-Shirt</li>
<li>Email: [email protected]</li>
<li>Another field: Value 1</li>
<li>Drinking: Coffee</li>
<li>Mug collection: 300</li>
<li>Another field: Value 2</li>
</ul>
</div>
We are using a mixture of list, paragraphs and images to get the markup we want. For instance, the list of fields is obviously a list, so we use the ul
unordered list element here. We're also using the img
tag here instead of background-image
because the profile image is important and contains actual information.
.profile {
padding: 20px;
background: #333 url('path/to/gradient.png') repeat-x;
overflow: hidden;
font-size: 13px;
line-height: 1.6em;
font-family: Arial, sans-serif;
color: white;
width: 960px;
}
.profile img {
width: 80px;
height: 80px;
border: 1px solid #eee;
display: block;
}
.profile .login-info, .profile .user-info li, .profile .user-info, .profile img {
float: left;
margin-right: 30px;
}
.profile .login-info {
margin-right: 60px;
}
.profile .user-info {
width: 665px;
font-size: 12px;
margin: 0;
}
.profile .user-info li {
width: 190px;
}
.profile .login-info .username {
display: block;
font-size: 18px;
font-weight: bold;
margin-top: 3px;
}
The CSS is separated from the markup - this is important, as we want to keep content and styling separate. Basically, using the class
es we have added inside the HTML, we give the contents of the profile styling information that will cause it to be presented in the manner you specified in the picture.
We float almost everything in that profile box, then give them specific widths so that they'll move up next to each other in columns, and finally give them a margin to the right to give them some space between the columns.
You can see it live here: http://jsfiddle.net/stEkY/