My q...">

Determining which font to use

I have a paragraph with an inline style as shown below:

<p style="font-family:georgia,garamond,serif;">

My question is, is there a way to find out which font is used by my page and what is the selection procedure?

+4
source share
4 answers

Dev Tools

Open the developer tools and find the computed styles, you will see which styles are applied and where ... including fonts.

font-family. , ( ) , @font-face . , , , , .

JavaScript

var el = document.getElementById("id");
var style = window.getComputedStyle(el, null).getPropertyValue("font-family");

JSFiddle

. MDN...

+3

F12. CSS. , , .

+1

. , , , , , , Garamond, , , , .

CSS , font-family, . , , , , . 1

Chrome Crtl + Shift + I, html , , .

javascript, .

+1

, style

//using id

var b = document.getElementById("p").style.fontFamily;
console.log(b);

//or using jquery tag selecter

console.log($("p").css('fontFamily'));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="p" style="font-family:georgia,garamond,serif;">
Hide result
0

Source: https://habr.com/ru/post/1682547/


All Articles