0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CSSで描いた正三角形を回転する

Last updated at Posted at 2022-10-12

はじめに

CSSでborderを使って正三角形を書く方法は分かったのですが、これを回転rotateさせると、borderで描いたので中心がわからないのできれいに回りません。

解決方法

これを解決するには、中心点originを変更する方法

transform-origin: 50% 66.6%; 


正三角形を内接円とするboxを描く方法があると思います。

実行例

後者でやってみたのでcodepenを貼り付けます。

See the Pen reeact-equilateral-triangle-rotate by kalz2q (@kalz2q) on CodePen.

終わりに

codepenのソースはこちら

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?