When including CSS in markdown, you need to make sure the CSS string includes the <style>...</style> tags and that you set the unsafe_allow_html=True optional keyword argument for st.markdown. Other than that, it can be anywhere on you page (I usually put my CSS hacks at the end to avoid the extra blank line they create.)
CSS hacks always have a caveat of breaking with version changes, so just be aware. Here’s an alternate solution I posted a while back if you want to try that CSS, too. (It should apply to all st.metrics on the page as written.)