0

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

enter image description here

3
  • i dont know about gradient, but you can create shapes with css using the border property and passing 4 parameters after it. Commented Feb 21, 2017 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 Commented Feb 21, 2017 at 10:04
  • Why not use SVG? In CSS it's probably easiest to transform two divs or try to use two CSS triangles like @xhulio mentioned. Commented Feb 21, 2017 at 10:04

1 Answer 1

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>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.