Categories
JavaScript Answers

How to detect which one of the defined font was used in a web page with JavaScript?

Spread the love

To detect which one of the defined font was used in a web page with JavaScript, we use the font property.

For instance, we write

const font = document.getElementById("header").style.font;

to select the element with getElementById.

And then we get the font used with the style.font property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *