Styled Headers With Underlines – CSS Tip
In a post yesterday, I had some new CSS working. My headings now have a nice line drawn under them. Here’s a sample:
Test Heading
This gives posts a more professional look that I really like. I got this idea from Paul’s style, but I wrote this CSS myself. Here’s the CSS you need to include:
1 2 3 4 5 6 7 | h2.with_underline { display: block; margin-top: 20px; width: 100%; color: #333; border-bottom: 1px #BBB solid; } |
So now wherever you want to have these nicely formated headers, just type:
1 | <h2 class="with_underline">Test Heading</h2> |
You could also make it global CSS so it affects all h2’s, and then you don’t have to put the class attribute in the HTML tag. This is a real simple addition to your CSS and makes your pages really pop.
-
Ranjani
-
Benjamin Hummel
-
Paul Stamatiou



