Site logo

Archived topic

Bootstrap min.css overwrites the font css

3 replies · Started by Adrian Cojocariu on September 25, 2015

Viewing posts 1–4 of 4

Hey man, long time no see, soz bout that.

I started working on a website again, and I've set up some fonts in the GP menu, but I need to use bootstrap too for a script let's say, I placed the link rel stylesheet in the top of the gp hooks, wp head, and it looks like this


<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

When I use it, the fonts don't work.

Any suggestions ?

I think I'm just gonna use collapse o matic though

Which fonts don't work? The ones set in Typography?

This is probably because the bootstrap CSS applies fonts to elements, and if the CSS is called after the custom CSS written by the theme, it will overwrite those values with the bootstrap CSS.

One way to avoid this is to call the bootstrap CSS before all the other CSS like this:

add_action( 'wp_enqueue_scripts', 'bootstrap_scripts', 0 );
function bootstrap_scripts() {
    wp_enqueue_style( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css' );
}

Thx man, I will try it.

This archived topic is closed to new replies.