Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to create backslash effect on div with css

I’m looking for a way to create this effect with CSS:

target effect

I got the red line and it is a simple div.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Does anyone know a way for getting this effect?

>Solution :

Based on the example on https://css-tricks.com/stripes-css/, I have used -45deg to create a "backslash" and blue instead but it should explain the concept. Use this as a basis to create a more complex background for your div:

div {
  background: repeating-linear-gradient(
    -45deg,
    #606dbc,
    #606dbc 10px,
    #465298 10px,
    #465298 20px
  );  
}
<div>
  hello
</div>

Learn more about the repeating-linear-gradient.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading