I'm a big fan of minimal use of images and was wondering if anyone had a tactic (or if it's possible) to create this kind of thing with pure static CSS?
http://www.flickr.com/photos/jahimandahalf/6780397612/
I'm referring an effect of a line seemingly getting skinnier and fading out and the shadow effect underneath it.
I was thinking it might be possible to do a CSS shape trick with it like the triangles:
http://css-tricks.com/snippets/css/css-triangle/
Or perhaps with rotation on box-shadow using 'transform':
zenelements.com/blog/css3-transform/
Any ideas?
You can use CSS3's stops and the
:after
pseudo-element to achieve such an effect. The trick is to add a border to the<hr>
element by using the:after
pseudo-element and position it in the center of the initial gradient with a soft color that ends with the gradient.Here is a quick demo, and another demo using some color.
Ok so I've answered my own question but I've read the Stackoverflow forums and it seems to be acceptable (if not actually encouraged!)
So...
HTML:
CSS:
In order to reproduce that horizontal rule, you can use a CSS3 linear-gradient. Just create a div with about a 3px height and apply the following CSS (change the colors as needed):
Keep in mind that
filter
does not support color stops, so you may want an image fall back for < IE10.Build your own CSS3 gradient here: http://www.colorzilla.com/gradient-editor/
This code create a normal hr but the difference will is it will have both end with fade effect(gradient black to blue)