+ 8

How can I draw a Triangle 🔺 ???

I want to draw a triangle .... And How can I rotate it ?????????😕

6th Jul 2018, 9:25 PM
Hani
Hani - avatar
7 Respuestas
+ 6
To rotate it, in the CSS, add: animation-name: turn; animation-duration: 10s; animation-timing-function: linear; And then add (not in the elements’s own CSS): @keyframes turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } So, altogether the CSS from KrOW ‘s answer and my answer will look like this: #triangle { width: 0px; height: 0px; border: 50px solid transparent; border-top: 0px; border-bottom-color: red; animation-name: turn; animation-duration: 5s; animation-timing-function: linear; animation-iteration-count: infinite; } @keyframes turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } And the HTML: <div id = “triangle”></div>
7th Jul 2018, 1:07 AM
Rowsej
Rowsej - avatar
+ 9
ill assume your block element(div,p) already has a width,height and positioning do.. elem{ clip-path:polygon(50% 0%,100% 100%,0% 100%,50% 0%); } bam.. your element is a triangle your can rotate elements using the: elem{ transform:rotate() } syntax
6th Jul 2018, 9:56 PM
᠌᠌Code X
᠌᠌Code X - avatar
8th Jul 2018, 4:38 PM
Yesh Jadav
Yesh Jadav - avatar
+ 3
With SVG, Canvas and HTML/CSS at example: // CSS #triangle{ width:0; height:0; border:50px solid transparent; border-top:0; border-bottom-color:red; } // HTML <div id="triangle"></div>
6th Jul 2018, 10:02 PM
KrOW
KrOW - avatar
+ 2
Hi Hani Ibrahim, There are lots of ways to draw a triangle. You may benefit from the variety of answers already provided in earlier posts by using the search bar. Hope this helps! ☺
6th Jul 2018, 9:37 PM
Janning⭐
Janning⭐ - avatar