Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css gradient Implement 2 color dashed border

Any ideas how to implement a custom border in css using gradient to look exactly like the following image

enter image description here

like image 537
mozenge Avatar asked May 13 '26 17:05

mozenge


1 Answers

Add a dashed border on a solid border.

body {
  background: #ccc;
}
div {
   width: 200px;
   height: 50px;
   border: 2px solid #fff;
   position: relative;
}
div::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px dashed black;
    margin: -2px;
}
<div></div>
like image 125
Debashish Avatar answered May 16 '26 06:05

Debashish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!