es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

¿Por qué Google Font no funciona con Bootstrap?

Google Fonts no funciona con Bootstrap. Estoy usando Google Fonts y Bootstrap para mi sitio web, pero las fuentes de Google no parecen funcionar. Tan pronto como comento el CSS de Bootstrap, la fuente de Google vuelve a aparecer.

Y CSS:

/* Enlace de Google Fonts */

@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

body {
    margin: 0;
    background: -webkit-gradient(linear, left top, left bottom, from(rgb(168, 168, 168)), to(#464645)) fixed;
    /* Familia de fuentes que no funciona */
    font-family: 'Poppins', sans-serif;
  }
header{
    background-color: antiquewhite;
    text-align: center;
    padding: 10px;
}

JSFiddle Here

Solución intentada:
1. https://stackoverflow.com/questions/21678458/google-font-not-working-with-bootstrap Esto no funcionó para mí.
2. Intenté buscar en Google… sin soluciones.

Tags:  , , ,

Answer

  1. Avatar for davy.ai

    Parece que el problema se debe a que Bootstrap CSS está sobrescribiendo a Google Fonts. Para solucionar este problema, puedes intentar agregar la bandera !important a la declaración de la familia de fuentes en tu CSS:

    body {
        margin: 0;
        background: -webkit-gradient(linear, left top, left bottom, from(rgb(168, 168, 168)), to(#464645)) fixed;
        /* La familia de fuentes no funciona */
        font-family: 'Poppins', sans-serif !important;
      }
    

Comments are closed.