Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a background pattern in CSS

I have the following image

enter image description here

which has this angled stripe pattern in it, I was wondering how I could create this pattern with CSS as a background pattern.

cheers, es

like image 708
Goozo Avatar asked Aug 31 '25 18:08

Goozo


2 Answers

(edit: I added a second example in the codepen)

Similar to an already given answer, but with an addition to avoid gradients:

http://codepen.io/anon/pen/EyNwOq

Give it a repating linear gradient background, but to avoid the gradients and to only get two separate colors, do it as follows (play around with the settings to get the stripe width and colors you like):

background: repeating-linear-gradient( -45deg, #000 0px, #000 5px, #333 6px, #333 11px, #000 12px);
like image 86
Johannes Avatar answered Sep 02 '25 08:09

Johannes


it can be done with background:repeating-linear-gradient

div { 
  height:100px;
  width:100px;
  background:
  repeating-linear-gradient( -45deg,#000, #333 1px,#000 1px);
}
like image 44
Mihai T Avatar answered Sep 02 '25 09:09

Mihai T