How to draw a curved and gradient colored trapezoid with HTML and css3 -
how draw curved , gradient colored trapezoid html , css3 attached image.
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:
mcommand used define starting point. appears @ beginning , specify point drawing should start.qcommand used draw curves.defselement used define element / objects later use insvgdocument.lineargradientelement used define gradients can applied shape or outline insvgdocument.
output:
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
Post a Comment