Getting the font-family of selected text?
November 30th, 2005I have the Firefox DOM Inspector doohickey (which you should have too if you do any significant amount of web design), and also a plugin called “Inspect Element.”
One cool trick you can do once you have all this set up is to highlight some text, click “Inspect element” in the context menu, and then select “Computed Style” from the dropdown in the right-hand pane of the DOM Inspector. Then you can go and look at font-family and see just what fonts are specified for the text you selected.
So, here’s my question:
It must be possible to access this info from Javascript. Then, I could make a one-click bookmarklet so I could select some text and have the font-family value pop up.
That would be fly. So… anyone know how to do it?
Bueller? Bueller?