Some design elements are so common that they almost become afterthoughts. The horizontal rule (
hr) is one of them. It’s easy to simply place them within our content without any attention to detail.
But this venerable HTML tag is capable of doing so much more – thanks to some clever CSS. Horizontal rules can be quite decorative, whether you prefer a bold or subtle design. They can also be used as an enhanced branding mechanism, complete with color and logo elements in tow.
If you’re looking to take your HR up to the next level, you’ll want to check out this collection of fanciful dividers that go beyond the default. Let’s dig in!
The Measure of an HR by John W
This example is incredibly clever, if a bit on the extreme side. It features a large conglomerate of
<hr> tags (100 in all) that are styled to simulate the look of a ruler. Practical? Maybe not. But it’s certainly creative.
Inline Lines by Ohad
While this snippet doesn’t use an actual horizontal rule, it simulates the effect with CSS. Text or other design elements can be placed inline with the divider, making for an attention-grabbing effect. It’s also delightfully simple in terms of code.
Iconic HR Shapes by szpakoli
Here’s proof that subtlety can still stand out. A standard horizontal rule is enhanced with shapes (circle, diamond, star, etc.) and provides for an attractive visual. Combined with the rule’s short width and bright color, it helps readers delineate one section of content from another.
Accordion Rules by Will Boyd
Accordions have become one of the more popular UI elements due to their penchant for being space savers. This pure CSS take on the feature includes horizontal rules as part of the user interface. A rare instance of the good old
<hr> being used for functional purposes.
Simple HR Style Variations by Mark Murray
This snippet offers nine interesting horizontal rules that can fit a variety of styles and use cases. Examples include the usage of symbols, centered text, colors and border patterns. There’s something here for everyone.
Medium Style with Accessibility by Zoë Bijl
Placing text inside a horizontal rule can be tricky. It often involves techniques that aren’t very accessible. This snippet is different, as it utilizes content from
<h2> tags. It not only offers a cool Medium-style aesthetic, but it’s friendly to screen readers as well.
Decorative & Minimal HR Designs by Ibrahim Jabbari
Perhaps you’d like your dividers to look nice without distracting from the rest of your content. This collection of 18 simple styles is for you. The effects are well-executed without going over the top with flashy features.
Charlie Brown’s Shirt or Bart Simpson’s Hair? by m0cha
When viewing this zig-zag pattern, one conjures up images of cartoon characters. But its also a clever bit of code. It’s a combination of two
<hr> tags with angled CSS gradients. Now, which character does it best represent? Let’s go with Bart’s hair.
(Horizontally) Divide and Conquer
Sure, the default styling of a horizontal rule gets the job done – but where’s the fun in that? Take a cue from the examples above and create something that compliments all of your great design work.
- 10 CSS Code Snippets That Demonstrate Responsive Text Techniques
- 8 Stunning CSS Snippets for Creating the Glassmorphism Effect
- 8 Pure CSS Games You Can Play in Your Browser
- Get into the Halloween Spirit with These Spooky Snippets
- 10 Stunning Examples of Text Distortion Effects in Web Design