Are there any best practices for manipulating HTML elements with PHP to achieve specific styling effects, such as adjusting font sizes for numerical values?

When manipulating HTML elements with PHP to achieve specific styling effects, such as adjusting font sizes for numerical values, it is best practice to use inline CSS styles or classes to apply the desired styling. This can be done by dynamically generating the CSS style based on the numerical value and then applying it to the HTML element.

<?php
$number = 10;

// Calculate font size based on the numerical value
$font_size = ($number < 10) ? '12px' : '16px';

// Apply the font size to the HTML element
echo '<div style="font-size: ' . $font_size . ';">' . $number . '</div>';
?>