Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to slant dashed border in CSS?

I am trying to design an envelope using CSS for a Mail App. My client wants dashed borders in this manner

enter image description here

How can I achieve that effect with CSS borders?

like image 416
Sai Datta Avatar asked Dec 03 '22 21:12

Sai Datta


2 Answers

You may have to play with the colors a little.

.enveloppe {
	padding: 1em;
	border: 16px solid transparent;
	border-image: 16 repeating-linear-gradient(45deg, red 0, red 1em, transparent 0, transparent 2em,
	              #b67 0, #b67 3em, transparent 0, transparent 4em);
	
	max-width: 20em;
}
<div class="enveloppe">Lorem Ipsum</div>
like image 113
Gerard Avatar answered Dec 11 '22 16:12

Gerard


If you want to change the position remove the margin of container class.

*:before,
*:after { box-sizing: border-box; }

html,
body {
  overflow: hidden; 
  padding: 0;
  margin: 0;
}

.container {
  width: 300px;
  height: 200px;
  margin:0 auto;
  background-image: repeating-linear-gradient(135deg, #F29B91 0px, #F09290 30px,  transparent 30px, transparent 50px, #83B3DB 50px, #84ADCB 80px, transparent     80px, transparent 100px);
  padding: 12px;
}

.container .inner {
  background: white;
  width: 100%;
  height: 100%;
}
<div class="container">
  <div class="inner">envelope design</div>
 </div>
like image 37
Avagana Avatar answered Dec 11 '22 17:12

Avagana