Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

217
Vistas
HTML input font-size is greater when defined as inherit

I am using Chrome and default font size is 16px as default.

I have an idea to adjust font-size according to screen width via media queries.

I saw some CSS experts adjusting default 16px font size to 1.6rem based system.

So idea behind scence is to equalize 1rem to 10px and use everything as rem then if needed to adjust something change only font-size so all measurements will change at same ratio.

See this example

* {
  font-size: inherit;
}

html {
    font-size: 62.5%;
}

body {
  font-size: 1.6rem;
}
<p>Hello</p>

<input type="text" value="Hello">

Can anybody explain why font-size in input is greater than p ?

Also if I try to obtain font-size in dev tools I can't get any value.

If I try to get it via JavaScript like this

document.getElementsByTagName("input")[0].style.fontSize

I get ''

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You get a null result on looking at the style because the inline style has not been set.

The two Hellos are not different font sizes - both are 16px, but the paragraph is Times New Roman and the input it Arial - set by the default within the browser, at least on my inspection in Chrome/Edge on Windows10.

It is worth using your browser's inspect facility to see exactly what is setting each of the styles, and it will show you the computed style as well.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Input does not inherit by default but you can set it to inherit with css:

input{font-family:inherit;}

* {
  font-size: inherit;
}

html {
    font-size: 62.5%;
}

body {
  font-size: 1.6rem;
}
input{font-family:inherit;}
<p>Hello</p>

<input type="text" value="Hello">

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda