使用 Window.getComputedStyle() 获取指定元素的 CSS 规则的值。

const getStyle = (el, ruleName) => getComputedStyle(el)[ruleName]

getStyle(document.querySelector('p'), 'font-size') // '16px'