Skip to content

Instantly share code, notes, and snippets.

@roachhd
Forked from LeaVerou/dabblet.css
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roachhd/127a94bbeb8653e47a46 to your computer and use it in GitHub Desktop.
Save roachhd/127a94bbeb8653e47a46 to your computer and use it in GitHub Desktop.
/**
* Border clipping with border-image
* Support: Chrome, Opera, Safari, Firefox. Cannot get it to work in IE11, even though it supports border-image…
* Note: In CSS Backgrounds & Borders 4, there will be a property to clip borders (likely called border-clip). Until then though…
* Author: Lea Verou
*/
div {
border-top: .2em solid; /* Sets the thickness, also serves as fallback when no border-image */
border-image: 100% 0 0 linear-gradient(90deg, currentColor 5em, transparent 0); /* 5em is the width of clipped border */
/* After this point, it’s just styling that’s not related to the effect. Yup, it’s only the 2 lines above! */
padding: 1em;
background: #ffe; /* to show that the border is actually clipped */
color: navy; /* change the color and notice that it adjusts */
}
<div>I could be a footnote now, with my cool clipped top border</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment