Styling Post Headings That Stick Out
Tags: Intermediate
Recently, I’ve noticed a trend in blog post headings where it sticks out of its base layout. I would like to share this technique for those who would like to give their post headings a new style. One tip to keep in mind when designing this is to make sure it fits your target audience screen resolution size.
Note that this technique may vary depending on your design. My goal is for you to grasp the main concept in this tutorial so you can experiment and apply it to your own projects.
Step 1. Wireframe – HTML
Start by visualizing the wireframe of how each post item will be laid out.
<div class="post"> <div class="postheader"> <!--Post Header Elements Goes Here--> </div> <!--Post Content Goes Here--> </div>
Step 2. Styling Wireframe – CSS
Each post entry will be wrapped within the .post class. Since we are using absolute positioning on the .postheader, be sure to add enough top padding on .post so the post content does not overlap with the heading.

.post {
margin: 0; padding: 110px 20px 20px;
float: left;
width: 560px;
position: relative;
}
.post .postheader {
background: url(postheader_bg.gif) repeat-x;
float: left;
width: 600px;
position: absolute;
left: 0; top: 0;
}
Step 3. Post Header Wireframe – HTML
Now we’ll look closer at how each element will be placed within the .postheader.

<div class="postheader"> <span class="date"><strong>Oct</strong>25 <small>2009</small></span> <h2><a href="#">Styling Blog Post Headers with CSS</a></h2> <a href="#" class="comments">25</a> <p> <span>Category: <a href="#">CSS</a> | Tags: <a href="#">Headings</a>, <a href="#">Tutorials</a></span> By <a href="#">Soh Tanaka</a> </p> </div>
Step 4. Styling Post Header – CSS
Date Style
The part that sticks out of the layout is the date. Set the positioning to absolute and pull it back -50px to the left.

.date {
background: url(date_bg.gif) no-repeat;
width: 46px; height: 57px;
float: left;
padding: 3px 5px 3px 0;
text-align: center;
font-size: 1.8em;
position: absolute;
left: -50px; top: 0;
}
.date strong, .date small {
font-size: 0.5em;
text-transform: uppercase;
display: block;
}
Comments Style
Similar to how we styled the date, we will use absolute positioning to push the comments block -10px to the top and -10px to the right.

a.comments {
position: absolute;
right: -10px; top: -10px;
background: url(comment_bubble.gif) no-repeat;
width: 34px; height: 39px;
padding: 7px 0 0;
text-align: center;
color: #fff;
font-size: 1.6em;
text-decoration: none;
}
Level 2 Heading Style
Since the comments area is bleeding over on top of the heading, make sure you have enough padding on the right side so it does not overlap. Set height and line-height to match so it can be vertically aligned. For those browsers that support text shadows, we can add a nice touch of letter press style using the text-shadow property.
.post .postheader h2 {
margin: 0; padding: 0 25px 0 10px;
font: normal 2.2em Georgia, "Times New Roman", Times, serif;
height: 62px; line-height: 62px;
text-shadow: 1px 1px 1px #cfeb7f;
}
.post .postheader h2 a {
text-decoration: none;
color: #222;
display: block;
}
Auxiliary Information Style
The aux information will be wrapped in a paragraph tag. To accommodate for the background image, be sure to add 60px padding to the left. For the category and tag information, wrap it in a span which will be floated to the right.
.post .postheader p{
font-size: 0.9em;
background: url(author_bg.gif) no-repeat 10px bottom;
height: 27px; line-height: 27px;
margin: 0; padding: 0 10px 0 60px;
color: #fff;
}
.postheader p a {color: #fff;}
.postheader p span {float: right;}
Conclusion
Now that you know how this technique is achieved, check out some of the sites below for inspiration! If you have any questions, suggestions, or concerns, please don’t hesitate to let me know.
Related Posts
Author Bio
My name is Soh Tanaka and I am a Los Angeles based designer/front-end developer specializing in CSS driven web design with an emphasis on usability and search engine optimization. I also run a CSS Gallery which is updated daily with the best CSS websites from around the world. Come check it out!
You can learn more about me or
Follow me on twitter for more updates and resources!
Did You Enjoy This Post?
Subscribe via RSS or by email to get all upcoming tutorials and articles delivered straight to you.












+ Add Comment35 Peeps Have Spoken Their Minds...
Nice tut again! I was searching for this one! For me very useful!
Great tutorial, and nice to see some live examples.
I know that the current trend is to ‘real time’ but when you google something and find a post from “Sep 23″ I find really annoying not to know of which year…
So designers, please, include the year of the blog post.
Great!
Thank you for sharing with us
Thank you very much for the really usefull post!!
fstephany: Sometimes leaving the dates may be intentional. I’ve seen a presentation from Tim Ferris where he talks about removing dates on individual posts, and showing dates only on the front page of the blog where you can see the recent posts. This way when someone arrives from a Google search doesn’t get put off from reading an old article since they won’t know it.
Might work for sites where content doesn’t really ‘age’ fast. On the other hand, I remember searching for Ruby on Rails plugins and finding a bunch of release posts with the plugin but no date, so I couldn’t tell whether this was the latest and greatest or whether it would even work with the latest release of Rails. Definitely need the year on technology/development related posts :)
P.S. Great post Soh! Thanks for mentioning my site.
Very in insightful, it’s good to see what sort of creative ideas are out there.
Benga creative
ooh very nice! This will come in handy for all the tweaks going on over at my blog right now :) Thanks!
great post :)
Nice post, very useful for me!
@Dmitry: I totally agree!
Thanks for the post Soh, really useful!
Thanks for the tutorial, I found it very useful.
Very nice post. you broke everything down nicely. Will probably have to use this!
If the heading was too long then it goes over the content. Could we use relative positioning to get the same effect, still have it inside the document flow?
You can take off the height / line height from the h2, then it should flow more naturally. If you go this route, just make sure your background image is able to accommodate for the vertical flexibility. A little bit of tweaking and it should be good to go :-) Thanks for pointing that out!
Fantastic !!!
Excellent post. CSS, is one of the best things in web development I have learned!
Link to this post goes into my “CSS Gems” bookmarks folder.
谢谢分享!
Thanks for sharing!
Do you want to study Chinese?
Good Information.. gone through few example and not all but bookmarked the page/blog for future reference.
very nice
Very useful piece of code. As Hassan wrote the same problem occur when you have more than 99 comments.
oh thanks soh!
This is cooool :). Thanks …
Nice tutorial, it one of those simple design touches that really lift the blog. Thanks.
very useful post…. but I want to know that… Is there any CSS property to make font smooth in IE?
nice tutorial. thanks a lot
Well laid out and explained. One note: a few of your “inspiration” sites are using a much-simpler negative margin technique to achieve a similar effect. Not always a viable solution and, per usual, there are some IE6 caveats, but well worth mentioning.
Thank you for sharing all of this wonderful information.
This is very fantastic
I love this tutorial..it’s exactly what i need..
thank you so much!
wordpress is so fun!
Nice post. Thanks for sharing this amazing post.
This is very helpful for us.
hi! nice tut! i’m here to learn, so im stickin’ with your site for awhile..and please give me some advice on my website, i a newbie so still learning through the way..hope you could suggest to make my site better. thanks man!
I’m usually using margin-left instead left.
which is better??
Speak Your Mind...