Ask Your Question
1

How can the border of a CSS line be prevented from disappearing during a rotation animation?

asked 2022-04-23 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-03-24 19:00:00 +0000

qstack gravatar image

One way to prevent the border of a CSS line from disappearing during a rotation animation is to use the "backface-visibility" property. Set it to "visible" on the element being rotated, and the border will remain visible on both sides of the element during the animation. Here's an example:

.box {
  border: 2px solid black;
  backface-visibility: visible;
  transition: transform 1s;
}

.box:hover {
  transform: rotate(360deg);
}

In this example, the "box" element has a border of 2px solid black and the "backface-visibility" property is set to "visible". When the element is hovered over, it rotates 360 degrees over a period of 1 second. Because the backface is visible, the border stays in view during the entire animation, regardless of the angle of rotation.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-23 11:00:00 +0000

Seen: 9 times

Last updated: Mar 24 '22