Text input on Chrome: line-height seems to have a minimum

后端 未结 8 695
無奈伤痛
無奈伤痛 2021-01-03 17:40

I\'m trying to style a text input with a value, text input with a placeholder, and a span, identically in Chrome. Specifically, I would like to control the line-height indep

8条回答
  •  借酒劲吻你
    2021-01-03 18:33

    Try like this

    As per the link:Firefox line-height issue with input fields

    line-height on input won't change unless you change the font-size

    so reduce the font-size:50px to 45px it will look fine.

    Code Below

       div { 
    line-height: 50px; 
    font-family: Arial; 
    } 
    
    span,input[type="text"],input[placeholder]{ 
    height: 50px; 
    width: 100px; 
    padding: 0; 
    min-height: 0; 
    display: inline-block; 
    font-family: inherit; 
    border: 2px solid red; 
    overflow: hidden; 
    vertical-align: top; 
    font-size:45px; 
    
    } 
    
    ::-webkit-input-placeholder { 
    color:#000000; 
    
    }
    

提交回复
热议问题