Why are my style bundles not rendering correctly in ASP.NET MVC 4?

前端 未结 4 1310
天命终不由人
天命终不由人 2021-01-31 08:04

So I am new to ASP.NET MVC 4 (well, I used 3 a little).

Anyway, in my BundleConfig.cs file, I am trying to load the Twitter Bootstrap css files and an additional s

4条回答
  •  你的背包
    2021-01-31 08:33

    I don't use bundles for Bootstrap (as an exception), but its minified versions, so this works for me:

    
    
    
    
    
    
        
        
        @ViewBag.Title
        
        
        
        
        
        @Styles.Render("~/Content/less")
        @Scripts.Render("~/bundles/modernizr")
    
    
    

    The part with the inline style is from http://www.initializr.com/ for the top NavBar, if you don't need it, just remove.

    Alternatively, you can do the same in your styles.css file:

    @import url('bootstrap.min.css');
    
    body {
        padding-top: 60px;
        padding-bottom: 40px;
    }
    
    @import url('bootstrap-responsive.min.css');
    
    You CSS Code below
    

提交回复
热议问题