Skip to content

Instantly share code, notes, and snippets.

@derekpunsalan
Created August 29, 2012 06:41
Show Gist options
  • Save derekpunsalan/3507536 to your computer and use it in GitHub Desktop.
Save derekpunsalan/3507536 to your computer and use it in GitHub Desktop.
Faded gradient borders
/* Faded gradient borders */
/* Inspired by: http://dribbble.com/shots/707099-UI-Nav-Work */
.nav {
background-color: #179eca;
background-image: -webkit-linear-gradient(top, rgb(23, 158, 202), rgb(24, 136, 190));
background-image: -moz-linear-gradient(top, rgb(23, 158, 202), rgb(24, 136, 190));
background-image: linear-gradient(top, rgb(23, 158, 202), rgb(24, 136, 190));
font-family: sans-serif;
font-size: 14px;
margin: 0;
padding: 0;
}
.nav li {
display: inline-block;
}
.nav a {
color: #105e80;
display: block;
font-weight: bold;
height: 48px;
line-height: 48px;
padding: 0 20px;
position: relative;
text-decoration: none;
text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.nav a.on,
.nav a:hover {
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,0.5);
}
/* Add the gradient border divider */
.nav a:after {
background-image: -webkit-linear-gradient(top, rgba(0,93,131,.5) 50%, rgba(0,93,131,.22) 100%);
background-image: -moz-linear-gradient(top, rgba(0,93,131,.5) 50%, rgba(0,93,131,.22) 100%);
box-shadow: 1px 0 0 0 rgba(255,255,255,.1);
content: "";
display: block;
height: 48px;
position: absolute; /* position the divider to the right edge */
right: -1px;
top: 0;
width: 1px;
z-index: 1;
}
<ul class="nav">
<li><a href="#">Oreo Cookies</a></li>
<li><a class="on" href="#">Gummi Bears</a></li>
<li><a href="#">Fruit Snacks</a></li>
</ul>
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
@nomansid81
Copy link

Hi Derek,

Would you happen to know if :before can be used to create a fade out edge for a css gradient?
I am currently using this:
background: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ffffff));

But need to fade out both edges (top right and top left).

Your advise will be appreciated,
Noman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment