-
-
Save roachhd/127a94bbeb8653e47a46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div>I could be a footnote now, with my cool clipped top border</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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