I've been experimenting with creating animated 3-D bars in a bar graph. To ensure there are no issues with stretching or aspect ratio, I decided to split each bar into three parts: (1) an SVG for the top of the bar, (2) a div with adjustable height for animating the bar upwards, and (3) another SVG for the bottom of the bar.
However, I'm encountering an issue where even though the width values seem correct when inspected (stretched to 100% of the container), they do not align perfectly. This problem becomes more noticeable during animations, as shown in the image below which highlights the three components of each bar. You can also view a demonstration of this issue in a CodeSandbox example.
This alignment issue is present in Chrome, mobile Chrome, and mobile Safari, although interestingly it's not always visible on Safari. What could be causing this lack of seamlessness? Could it be related to my usage of SVGs, dimensions, or perhaps some floating-point error with percentages?