I'm going to guess that you're going to need a bit of trigonometry if you're unlucky, 2D CSS transforms (specifically rotate), and the ::before & ::afterpseudo-elements. My initial approach would be to construct the lines of out the borders of the before/after elements and rotate them into place.
(This is assuming we can't use SVG for some reason. It can handle pretty much any shape easily, but figuring out how to use SVG in the first place is a barrier to entry.)
What kind of triangle are you trying to make? This StackOverflow answer has some interesting magic, but it may or may not work for you depending on what you're trying to do.
Log in to continue
We're a place where coders share, stay up-to-date and grow their careers.
Hey can you help me do a responsive triangle instead? I've been trying for a while and can't get it to work
I believe if you try and do it with Border and border radius, it might be possible.
I'm going to guess that you're going to need a bit of trigonometry if you're unlucky, 2D CSS transforms (specifically
rotate
), and the::before
&::after
pseudo-elements. My initial approach would be to construct the lines of out the borders of the before/after elements and rotate them into place.(This is assuming we can't use SVG for some reason. It can handle pretty much any shape easily, but figuring out how to use SVG in the first place is a barrier to entry.)
What kind of triangle are you trying to make? This StackOverflow answer has some interesting magic, but it may or may not work for you depending on what you're trying to do.