'Have set font-family on body but textarea wont apply it [duplicate]

On my css file, I've set the following:

body {
  font-family: Roboto, sans-serif;
}

And as expected, it has applied to the entire html except for a "textarea" box which for some reason has applied what seems to be the consolas font.

My current fix for this is to select the specified element and set the same line of code posted above.

textarea {
  font-family: Roboto, sans-serif;
}

Any suggestions?



Solution 1:[1]

As you've discovered, the default value for font-family for textarea elements is not inherit.

It is for most elements, but since textareas often care about whitespace, browser stylesheets for them default to a monospace font.

If you want to change it, then you need to do so with a rule that targets the textarea — as you've done.

This is normal.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Quentin