Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border not transparent with linear gradient

Why when I apply transparent border to div with linear-gradient, border is not transparent on top and bottom.

div {
  width: 300px;
  height: 300px;
  background: linear-gradient(pink, red);
  border: 20px solid transparent;

}

screenshot http://i43.tinypic.com/2r3gjmx.png

like image 842
dimann90 Avatar asked Sep 15 '25 05:09

dimann90


1 Answers

For anybody who's looking for a solution:

TLDR

background-origin: border-box;

Explanation https://developer.mozilla.org/en-US/docs/Web/CSS/background-origin

like image 85
visitor Avatar answered Sep 16 '25 20:09

visitor