CSS Date Blocks for Blogs

Originally published: 09/2005 by J Wynia

You've probably been seeing the little date blocks that people have started using recently in their blog designs (even if you didn't notice them).
Example:


SEP


05


2005


I've seen a few instances and explanations of these that go to lengths as extensive as generating images on the fly. That's totally overkill for what 3 little DIV tags and a couple of CSS classes can accomplish. You also gain the fact that your date information will actually be present in your HTML.

The CSS:

.dateblock {
text-align: center;
width: 50px;
font-family: Arial;
}
.day {
font-size: 26px;
position: relative;
top: -5px;
}
.month {
font-size: 12px;
}
.year {
font-size: 12px;
position: relative;
top: -10px;
}

Example HTML

<div class="dateblock">
<div class="month">
SEP
</div>
<div class="day">
05
</div>
<div class="year">
2005
</div>
</div>

Extending it
One obvious extension would be to make the dateblock container float:left next to, say, a blog post. The result would be something along the lines of a dropcap for your date. The CSS numbers for pixel alignment, sizes, etc. are tied to the font chosen. If you chose another font (and I will for my own instances) the numbers will change.

Another intriguing option would be to use the sIFR web fonts to get out of the default fonts available on the web. It would take some trial and error to get the sizing right, but then you'd be able to use nearly any font you like.

A border and appropriate padding on the container will look like this (mouseover extended examples to see the combined HTML/CSS):




SEP


05


2005



Throw in a background and inverted colors and you get:




SEP


05


2005



Change the color and you can match whatever site theme you are after:



SEP


05


2005


Comments

David on 9/8/2005
Very nice!
css : date cards at Community Groups Web Site Project on 9/13/2005
[...] css date blocks for blogs [...]
Idiotprogrammer » Blog Archive » J. Wynia on Literary Collaboration and Open Source on 11/3/2005
[...] Tricks by J. Wynia: Using CSS to create date blocks . Putting fake postit notes on a resume. Using mindmaps/freemaps to outline creative ideas. [...]
Ravi on 9/27/2006
Thank you so much! It helped me a lot. God bless.
Steve on 10/9/2006
Used this on my blog site. Thanks.
qureyoon on 3/13/2007
nice and simple ^^
david blanchet on 9/6/2007
sweet, just what i was looking for thanks!
DamionKutaeff on 3/22/2008
Hello everybody, my name is Damion, and I'm glad to join your conmunity, and wish to assit as far as possible.
blog comments powered by Disqus
Or, browse the archives.
© 2003- 2013 J Wynia. Very Few Rights Reserved. This article is licensed under the terms of the Creative Commons Attribution License. Quoted content or content included from others is not subject to that license and defaults to normal copyright.