自定义css由浏览器中的Bootstrap覆盖 [英] Custom css overridden by Bootstrap in browser

查看:158
本文介绍了自定义css由浏览器中的Bootstrap覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的样式表目录设置如下

I have my stylesheet directory set up like this

stylesheets
    bootstrap.min.css
    style.css



在我的style.css中,我想像这样编辑pre标签: p>

In my style.css, I want to edit the pre tag like this:

pre {
    background-color: #d9edf7;
    border: #d9edf7;
    color: navy;
}

但是,这并没有在浏览器中被选中。看起来像浏览器在bootstrap.min.css中的样式。这是Chrome的检查器工具,当我将鼠标悬停在pre标签块:

However, this is not getting picked up in the browser. It seems like the browser is going with the styles in bootstrap.min.css. This is what it looks like in Chrome's inspector tools when I hover over the block of pre tag:

那么如何让它使用我的自定义css呢?

So how do I get it to use my custom css instead?

推荐答案

您必须确保在Bootstrap CSS之后包含您的自定义CSS,如下所示:

You have to make sure you include your custom CSS after the Bootstrap CSS, like the following:

<head>
    <!-- don't include your custom CSS here! -->
    <link rel="stylesheet" type="text/css" href="bootstrap.css">
    <link rel="stylesheet" type="text/css" href="custom.css">
    <style>
        pre {
            background-color: #d9edf7;
            border: #d9edf7;
            color: navy;
        }
    </style>
</head>

这篇关于自定义css由浏览器中的Bootstrap覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆