I am trying to create a little graphical box for a time element on a website. What I would like to have is something like this:

I have this HTML:
<div class="entry-meta">
<time class="entry-date" datetime="2011-09-16T09:59:48+00:00" pubdate="">
<span class="date-day">16</span>
<span class="date-month">Sep</span>
<span class="date-year">2011</span>
</time>
</div>
And this CSS so far:
.entry-meta {
display: block;
color: white;
float: left;
background: #aaa;
}
.date-day {
display: block;
font-size: 30px;
background: #444;
float: left;
}
.date-month {
display: block;
font-size: 12px;
background: #666;
float: left;
}
.date-year {
display: block;
font-size: 12px;
background: #888;
float:left;
}
My problem is that I cannot achieve two things:
- To align the text to the corners of the box and forget about the baseline. I would like to align 16 to the top left corner and cut it’s box at the bottom right corner. I am looking for eliminating all the spacing pixels.
- To move the year under the month, without specifying exact width and height properties. If I delete float: left then it goes under the day. What I would like to have is to move it right of the day and under the month. Do I need to create an other div or spand for the month + year?
- Also, it seems that it doesn’t matter if I remove
display: blockfrom the span CSS-es why is it?
Here is a jsFiddle I created:
http://jsfiddle.net/ESbqY/3/

An update one based on Kolink’s suggestion:
http://jsfiddle.net/ESbqY/5/

Fully customizable:
http://jsfiddle.net/5MMc9/8/
html:
css:
Furthermore, you can add
display: inline-block;to the month css if you want the div to be same width as text inside.