Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS for browser default font

If web designer has a full control over the entire code, it is easy to use browser default font - just don't change any font style and you got it.

However if there is not a full control over it and for example there is some font-related style defined on html or body element, or font-related CSS style for * { ... }, then there is a need to redefine font style to not inherit modified styling.

Is there any way, CSS, pure JavaScript or jQuery solution that would allow explicitly set browser default font for specific element?

like image 579
Ωmega Avatar asked Dec 15 '13 01:12

Ωmega


2 Answers

Unfortunately, there is no simple "initial value" for font-family. It is, as you know, user-agent dependent.

Perhaps the closest you can come is by using a font keyword. font-family:serif; will use whatever the browser considers to be the default serif font. font-family:sans-serif; is the same, for sans-serif.

This is the closest I can suggest, sorry!

like image 97
Niet the Dark Absol Avatar answered Sep 21 '22 03:09

Niet the Dark Absol


Yes. Do

.my-selector {
    font: initial;
}
like image 30
Domenic Avatar answered Sep 22 '22 03:09

Domenic