Why are CSS-styles not inherited by HTML form fields?

前端 未结 4 690
挽巷
挽巷 2020-12-03 23:42

I want to set the font-style and font-size of the text in my HTML document.



    Style inheritance
    &l         


        
4条回答
  •  情书的邮戳
    2020-12-04 00:12

    input, select, textarea button - They do not inherit by default but you can set it to inherit with css

    input, select, textarea, button {font-family: inherit;}
    

    Live Demo: http://jsfiddle.net/rvjKE/

    body {
      font-family: courier;
    }
    
    input {
      width: 250px;
    }
    
    input.inherit {
      font-family: inherit;
    }
    simple text should be courier

提交回复
热议问题