본문 바로가기
HTML&CSS/CSS

[CSS] font-family 상속이 안되는 속성

by g2hans 2021. 9. 7.

❓ 문제의 발단

작업을 하는 도중, input 태그와 textarea 태그의 폰트 스타일이 다르다는 것을 알게되었다.

📚 문제 해결

form과 관련된 태그들은 font-family가 기본스타일을 따른다고 한다. 

By default, browsers render most form elements (textareas, text boxes, buttons, etc) using OS controls or browser controls. So most of the font properties are taken from the theme the OS is currently using.

You'll have to target the form elements themselves if you want to change their font/text styles - should be easy enough by selecting them though, as you've just done.

As far as I know, only form elements are affected. Off the top of my head: input, button,  textarea,  select.
- stackOverflow

 

관련된 내용을 공식문서 등을 통해서 찾고싶었는데 찾을 수 없어었다.. 저 위에 언급된 태그들 (input, button, textarea, select)외에 어떤 것이 있을지 몰라 전체 태그에 사용하고자하는 폰트 스타일을 적용했다.


참고링크

🖇 지니코딩 - Why <textarea> and <textfield> not taking font-family and font-size from body?

🖇 stackoverflow - Why <textarea> and <textfield> not taking font-family and font-size from body?

 

댓글