Textarea font different from input fields
Issue: The font in the textarea
(body field) differed from input
fields (e.g., title).
Cause: Textareas often default to a monospace font in browsers, while other inputs might inherit the body font. The shared CSS rule for inputs/textarea didn't explicitly set font-family
.
Resolution: I added font-family: inherit;
to the shared CSS rule for input, textarea
.
Learning: I learned to explicitly set font-family: inherit;
on form controls (input
, textarea
, select
, button
) to ensure they consistently use the base font defined higher up in the CSS cascade (e.g., on body
), avoiding default browser discrepancies.
Learned on: April 19, 2024
Edit