Overwrite Bootstrap classes with CSS file

0

I'm having a hard time overriding some Bootstrap classes using a CSS file I created. I'm using the Bundle to make these changes:

public static void RegisterBundles(BundleCollection bundles, bool premium =true)
{
    #region Default Web Site

   ..........

    #region Templates Layout

    if (premium)
    {
        bundles.Add(new StyleBundle("~/Templates/premium").Include(
        "~/Templates/*.css"));
    }


    #endregion

    #endregion

}

I declared the bundle in Layout:

<!DOCTYPE html>
<html>
<head>
    <noscript>
        <meta http-equiv="refresh" content="0;url=/NoJScript" />
    </noscript>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")

    @Styles.Render("~/Templates/premium")
</head>
<body>

CSS file code:

.container .navbar-default {
    background-color: #a6d209;

And even then the nav bar does not change the color you insert into the external file.

Thefileiscomingintheorderyouinsertintothebundle,itiscorrect.Theyarecomingafterthebootstrap.cssandsite.css

    
asked by anonymous 04.01.2017 / 17:18

1 answer

1

You have to check the order that CSS is executing. But if you do this:

background-color: #a6d209 !important;

Your CSS will prevail.

    
04.01.2017 / 17:49