Introduction

This article explains how to create a calendar icon for your blog or website, and yes, it is scalable, so you can resize it to any ratio and it will not be blurred just by changing a font-size.
You’re free to change the color/size of the text or an icon or anything as you prefer. I’m going to show you how.
Figure 1: Template Div
The following is the template that I will be modifying to get the desired output. It contains the main wrapper Div and three elements inside for Day, Month and Date respectively. I had the option to put all the three in a span but just to reduce the complexity of the CSS I put them in separate tags.
And here’s the style for this icon wrapper, you can change the size of the icon in just one go by changing the wrapper’s font-size attribute.
Figure 2: Icon Wrapper style
Here’s the complete HTML and CSS:
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Reusable Calendar Icon</title>
  5. <style type="text/css">
  6. Body
  7. {
  8. font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
  9. font-size: 100%;
  10. margin: 10px;
  11. color: #333;
  12. background-color: #cecece;
  13. }
  14. div.calendarDate{
  15. font-size:1em; /*change calendarIcon size */
  16. display: block;
  17. position: relative;
  18. width: 7em;
  19. height: 7em;
  20. background-color: #fff;
  21. border-radius: 0.7em;
  22. -moz-border-radius: 0.7em;
  23. box-shadow: 0 1px 0 #bdbdbd, 0 2px 0 #fff, 0 3px 0 #bdbdbd,
  24. 0 4px 0 #fff, 0 5px 0 #bdbdbd, 0 0 0 1px #bdbdbd;
  25. overflow: hidden;
  26. }
  27. div.calendarDate *
  28. {
  29. display: block;
  30. width: 100%;
  31. font-size: 1em;
  32. font-weight: bold;
  33. font-style: normal;
  34. text-align: center;
  35. }
  36. div.calendarDate strong
  37. {
  38. position: absolute;
  39. top: 0;
  40. padding: 0.4em 0;
  41. color: #fff;
  42. background-color: #19aaaa;
  43. border-bottom: 1px dashed #ddd;
  44. box-shadow: 0 2px 0 #19aaaa;
  45. }
  46. div.calendarDate em
  47. {
  48. position: absolute;
  49. bottom: 0em;
  50. color: #fff;
  51. padding-top:.2em;
  52. height: 1.6em;
  53. background-color: #19aaaa;
  54. }
  55. div.calendarDate span
  56. {
  57. font-size: 2.8em;
  58. letter-spacing: -0.05em;
  59. padding-top: 0.65em;
  60. color: #2f2f2f;
  61. }
  62. </style>
  63. </head>
  64. <body>
  65. <div class="calendarDate">
  66. <em>Saturday</em>
  67. <strong>December</strong>
  68. <span>21</span>
  69. </div>
  70. </body>
  71. </html>
Just in case you may want to fiddle around, see: http://jsfiddle.net/sunnykumar08/ZqcrA/
Thanks for reading this article, I hope you find this article useful. Feedback and comments are highly appreciated!