Asp.net

更改後未應用 CSS

  • June 10, 2011

我有一個問題,我無法在我的 ASP.NET MVC 應用程序中應用 CSS 中的樣式。行為是它第一次應用,然後對 CSS 的後續更改沒有反映在我的 _Layout.cshtml 中。我不確定我在這裡缺少什麼。

CSS 文件

body
{
   font-size: .85em;
   font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif;
   color: #232323;
   background-color: #fff;
}

header,
footer,
nav,
section {
   display: block;
}

/* Styles for basic forms
-----------------------------------------------------------*/

fieldset 
{
   border:1px solid #ddd;
   padding:0 1.4em 1.4em 1.4em;
   margin:0 0 1.5em 0;
}

legend 
{
   font-size:1.2em;
   font-weight: bold;
}

textarea 
{
   min-height: 75px;
}

.editor-label 
{
   margin: 1em 0 0 0;
}

.editor-field 
{
   margin:0.5em 0 0 0;
}


/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error
{
   color: #ff0000;
}

.field-validation-valid
{
   display: none;
}

.input-validation-error
{
   border: 1px solid #ff0000;
   background-color: #ffeeee;
}

.validation-summary-errors
{
   font-weight: bold;
   color: #ff0000;
}

.validation-summary-valid
{
   display: none;
}
#Header
{
   color:white;
   padding:1px;
}
#Content
{
   float:left;
   margin:10px;
}
#SideBar
{
   float :left;
   margin:10px;
   padding :10px;
   border:  dotted 1px  red;
   width:180px;
   font-style:italic;
}
#Footer
{
   text-align:center;
   clear:both;
}

例如,我將#SideBar 中的“邊框”從紅色更改為黑色。但它總是顯示紅色。我可能在這裡做一些根本錯誤的事情。

_Layout.cshtml

<!DOCTYPE html>
<html>
<head>
   <title>@ViewBag.Title</title>
      <!--link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />-->
     <link href="@Url.Content("~/Content/SiteStyle.css")" rel="stylesheet" type="text/css" />
   <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
   <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
</head>

<body>
  <div id="Header" style="background-image: url('/Content/Images/Banner_Final3.png'); background-repeat:no-repeat; width :1500px; height : 150px;"   >

  </div>
  <div id="SideBar">
      @Html.Partial("UserControls/UserLogin", new AlanBeezLab.Models.LoginModel())
  </div>
  <div id="Content">
       @RenderBody()
  </div>
  <div id="Footer">
       <p>Copyright © XXXXXXX</p>
  </div>
</body>
</html>

但是,如果重命名物理文件並更改 _Layout.cshtml 中的引用,我可以看到我所做的更改。

請幫忙。

謝謝

點擊 Ctrl-F5 重新載入頁面而不使用記憶體的內容

引用自:https://stackoverflow.com/questions/6303053