Using JavaScript to calculate and set inline styles (like element heights) is an anti-pattern. Instead, pass raw data values to CSS via custom properties and let CSS handle the styling logic using functions like calc() and min(). This approach keeps styling concerns in CSS, makes updates easier to find and change, and likely improves performance by offloading visual calculations from JavaScript.
β’5m watch time
340.1K Impressions10 Comments