0

How we can create the responsive shape with css gradient like the attached image.

enter image description here

web-tiki
  • 99,765
  • 32
  • 217
  • 249
Mehar
  • 2,158
  • 3
  • 23
  • 46
  • i dont know about gradient, but you can create shapes with css using the border property and passing 4 parameters after it. – xhulio Feb 21 '17 at 10:01
  • for example the following css: `border-style: solid; border-width: 176px 176px 0 176px; border-color: #1e2e42 transparent transparent transparent;` will give a triangle – xhulio Feb 21 '17 at 10:04
  • Why not use SVG? In CSS it's probably easiest to transform two `div`s or try to use two [CSS triangles](https://css-tricks.com/snippets/css/css-triangle/) like @xhulio mentioned. – Luuuud Feb 21 '17 at 10:04

1 Answers1

2

I've added an example for doing this with HTML and CSS. This is just one way of doing it of course.

div{
  
  height: 15px;
  
  width: 50%;
  
  background-color: black;
  
  position: absolute;
  
  top: 0;
  
}

.left{
  
  transform-origin: top right;
  transform: rotate(-5deg);
  
}

.right{
  
  left: 50%;
  
  transform-origin: top left;
  transform: rotate(5deg);
  
}
<div class="left"></div>
<div class="right"></div>
Luuuud
  • 4,206
  • 2
  • 25
  • 34