在mvc中找不到Css? [英] Css not found in mvc?

查看:143
本文介绍了在mvc中找不到Css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的_Layout.cshtml文件在我的代码下面运行完全但是我没有得到css PLZ帮助Thnx提前... :)

 <  !DOCTYPE     html  >  
< html lang = zh_CN >
< head >
< meta charset = utf-8 / >
< span class =code-keyword>< title > @ ViewBag.Title - 主页< / title >
< link < span class =code-attribute> href = 〜/ favicon.ico rel = 快捷方式图标 类型 = image / x-icon / >
< link rel = 样式表 href = css / style.css type = text / css / > <! - 样式 - >
< link < /跨度> < span class =code-attribute> rel = stylesheet href = css / responsive.css type = text / css / > <! - 自适应 - >

< meta name = viewport content = width = device-width,initial-scale = 1.0 / >
@ Styles.Render(〜/ Content / bars / css)
@ Scripts.Render(〜/ bundles / modernizr )
< / head >
< body > ;
< header >
< div class = content-wrapper >
< div class = float-left > ;
< p class = site-title > @ Html.ActionLink(您的徽标在这里,索引,主页)< / p >
< / div >
< div class = float-right >
< 部分 id = 登录 >
@ Html.Partial(_ LoginPartial)
< span class =code-keyword><
/ section >
< nav >
< ul id = menu >
< li > @ Html.ActionLink(主页,索引,主页)< / li >
< li > @ Html.ActionLink(关于,关于,主页)< / li >
< li > @ Html.ActionLink(联系人,联系人,主页)< / li >
< / ul >
< ; / nav >
< / div >
< / div >
< / header >
< div id = body >
@RenderSection(featured,required:false)
< 部分 < span class =code-attribute> class
= content-wrapper main-content clear-fix >
@RenderBody()
< / section >
< / div >
< 页脚 >
< div class = content-wrapper >
< div class = float-left >
< p > ©@ DateTime.Now .Year - 我的ASP.NET MVC应用程序< / p >
& / div >
< / div >
< / footer >

@ Scripts.Render(〜/ bundles / jquery)
@RenderSection(scripts,required:false)
< / body >
< / html >

解决方案

确保css的bundle在App_Start中的bundleConfig.cs中正确定义以用于下面的包

包含你需要的css文件



 @ Styles.Render(〜/ Content / bars / css)


My _Layout.cshtml file is below my code runs completely but I don't get css PLZ Help Thnx in Advance... :)

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - Home</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <link rel="stylesheet" href="css/style.css" type="text/css" /><!-- Style -->
<link rel="stylesheet" href="css/responsive.css" type="text/css" /><!-- Responsive -->	

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
        @Styles.Render("~/Content/bars/css")
        @Scripts.Render("~/bundles/modernizr")
    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
                </div>
                <div class="float-right">
                    <section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>
                    <nav>
                        <ul id="menu">
                            <li>@Html.ActionLink("Home", "Index", "Home")</li>
                            <li>@Html.ActionLink("About", "About", "Home")</li>
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>© @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

解决方案

make sure bundle for css define correctly in bundleConfig.cs in App_Start for bellow bundle
with your required css files

@Styles.Render("~/Content/bars/css")


这篇关于在mvc中找不到Css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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