¿Cómo ajustar automáticamente el tamaño de fuente usando CSS?

La propiedad font-size-adjust de CSS le dice al navegador que ajuste el tamaño de fuente del texto al mismo tamaño independientemente de la familia de fuentes. Cuando la primera fuente elegida no está disponible, la propiedad font-size-adjust le permite tener más control sobre el tamaño de la fuente. Si una fuente no está disponible, la ventana muestra por defecto la segunda fuente definida. Esto podría conducir a un cambio significativo en el tamaño de la fuente. Usando la propiedad font-size-adjust para detener esto. La diferencia de tamaño entre la letra minúscula «x» y la letra mayúscula «X» es el «valor de aspecto» de todas las fuentes. Cuando el navegador conoce el «valor de aspecto» de la primera fuente, determinará qué tamaño de fuente usar al ver el texto en la segunda fuente.

Sintaxis:

font-size-adjust: number|none|initial|inherit;

A continuación se muestran los ejemplos que ilustran el uso de la propiedad font-size-adjust .

Ejemplo:

HTML

<!DOCTYPE html>
<html>
  
<head>
   <style>
    div.a {font-family: Helvetica;}
    div.b {font-family: 'sans-serif';}
    #div1, #div2 {font-size-adjust: 0.74;}
   </style>
</head>
  
<body>
  <h1 style = "color:green;text-align:center;"> 
    GeeksforGeeks 
  </h1>
  
  <h2 style = "color:blue;text-align:left;">
    Font Size Adjust Property
  </h2>
  
  <h2 style ="color:orange;text-align:left;">
    Divs with same Font Size Adjust Property:
  </h2>
  
  <div id="div1" class="a">
    We offer a range of services to help you learn, 
    develop, and have fun! Free tutorials, millions 
    of posts, live, online, and classroom classes, 
    regular coding contests, industry expert webinars, 
    internships, and career openings are all available.
  </div><br>
    
  <div id="div2" class="b">
    Sandeep Jain is the founder of 'GeeksforGeeks,'
    an IIT Roorkee alumni group. He enjoys finding 
    the most effective solutions to programming problems. 
  </div>
  
  <h2 style = "color:red;text-align:left;">
    Divs without same Font Size Adjust Property:
  </h2>
  
  <div class="a">
    Apart from GeeksforGeeks, he has worked as a web 
    developer for DE Shaw and Co. and as an assistant 
    professor at JIIT Noida. 
  </div><br>
  
  <div class="b">
    GeeksforGeeks.org was founded with the aim of 
    providing well-written, well-considered, and 
    well-explained answers to specific questions. 
    If you're interested in mastering algorithms, 
    data structures, or just the programming language itself, 
    GeeksforGeeks has you covered!
  </div>
</body>
  
</html>

Producción :

Ajuste automático del tamaño de fuente usando CSS

Soporte del navegador:

Solo Firefox admite actualmente la propiedad CSS font-size-adjust de forma predeterminada.

Publicación traducida automáticamente

Artículo escrito por piyushkr2022 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *