linear-gradient border
Im trying to apply a linear-gradient border to an element, so I just have a div and the ::before element with position absolute but the problem is the ::before wont go behind the div even with z-index:-1;
Here's a quick jsbin to see what Im talking about : https://jsbin.com/cujusodumi/edit?html,css,output
JS Bin
A live pastebin for HTML, CSS & JavaScript and a range of processors, including SCSS, CoffeeScript, Jade and more...
4 Replies
you should not set z-index on the main element, it will create a new stacking context which prevens childs (or pseudo's) to go behind it
but you can make it a bit easier witout the use of a pseudo element
for your hover example, you can set the default border-color to black, and on hover transparent
ohh ok I'll try it thx, I was trying with 1px borders but I got weird visual glitch where the gradient circle is 'bigger' on some sides of the circle
yep, that's going to happen with super thin borders. It's a hardware limitation. With a 1px width border there just aren't enough pixels available for the browser to render the rounding of the the corners in the way we expect.
ok I see, cool to know thx for the info