How to draw a curved and gradient colored trapezoid with HTML and css3 -


how draw curved , gradient colored trapezoid html , css3 attached image.

enter image description here

i have code.

#trapezoid {   height: 0;   width: 120px;   border-bottom: 80px solid #05ed08;   border-left: 45px solid transparent;   border-right: 45px solid transparent;   padding: 0 8px 0 0;  }
<div id="trapezoid">trapezoid</div>

svg recommended way create such shapes. offers simplicity , scale ability.

the idea create curve , stroke(outline) gradient. can use svg's path element create curve.

only 1 attribute d used define shapes in path element. attribute contains number of short commands , few parameters necessary commands work.

below necessary code create shape:

<defs>     <lineargradient id="gradient">         <stop offset="0" stop-color="#e20016" />         <stop offset="100%" stop-color="#ed6f1d" />     </lineargradient> </defs> <path d="m30,75 q100,20 170,75" stroke="url(#gradient)" stroke-width="90" fill="none" /> 

i've used 2 commands inside path element. below brief description:

  • m command used define starting point. appears @ beginning , specify point drawing should start.
  • q command used draw curves.
  • defs element used define element / objects later use in svg document.
  • lineargradient element used define gradients can applied shape or outline in svg document.

output:

output image

working example:

<svg width="200" height="150" viewbox="0 0 200 150">    <defs>      <lineargradient id="gradient">        <stop offset="0" stop-color="#e20016" />        <stop offset="100%" stop-color="#ed6f1d" />      </lineargradient>    </defs>    <path d="m30,75 q100,20 170,75" stroke="url(#gradient)" stroke-width="90" fill="none" />  </svg>


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -