.corner {position: absolute;top: -2rem;right: -2rem;width: 0;height: 0;border: 2rem solid red;border-bottom-color: transparent;border-top-color: transparent;border-left-color: transparent;transform: rotateZ(135deg);
}
基本思路就是設置border,只設置一邊,其他3個透明,然后再位移旋轉。
注意這個方法,寬高基本是原來設置的正方形的根號2大小,(因為是用斜角邊來做寬度了)
??????? 例如設計稿上是100px,那么就素141.43差不多等于原設的寬高,也可以直接用Math.sqrt來做
然后文字的話,重新畫一層蓋上去,
文字就是?' absolute -right-2 -top-2 font-semibold h-16 w-16 flex justify-center items-center flex-nowrap rotate-45 text-[11px] ',