2013-03-25 132 views
0

我創建了一個MVC 4應用程序(Internet模板)。它創建的身體寬1903px,高300px。在下面的圖片中,你可以看到它是如何渲染的。我沒有看到寬度被指定的地方,我很好奇它爲什麼決定創建寬度爲1903px(高度爲300px)。MVC 4 - 爲什麼我的身體設置爲1903px x 300px?

enter image description here

如果有幫助,主要頁面的HTML如下所示:

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title>@ViewBag.Title - The Exchange Site</title> 
     <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
     <meta name="viewport" content="width=device-width" /> 
     @Styles.Render("~/Content/css") 
     @Scripts.Render("~/bundles/modernizr") 
    </head> 
    <body> 
     <header> 
      <div class="content-wrapper"> 
       <div class="float-left"> 
        <img src="~/Images/CompanyLogo.png"> 
       </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"> 
      <section class="content-wrapper main-content clear-fix"> 
       @RenderBody() 
      </section> 
     </div> 
     <footer> 
      <div class="content-wrapper"> 
       <div class="float-left"> 
        <p>&copy; @DateTime.Now.Year - Siesta Key Software, LLC</p> 
       </div> 
      </div> 
     </footer> 

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

_「它創建的身體寬1903px,高300px」_--你在哪裏看到這個?當沒有'@ Styles.Render(「〜/ Content/css」)'和'@ Scripts.Render(「〜/ bundles/modernizr」)''渲染時,你有同樣的問題嗎? – CodeCaster 2013-06-17 13:34:25

回答

0

我剛剛一模一樣的問題/問題。它根據瀏覽器窗口的寬度設置寬度。如果你縮小窗口並刷新屏幕,你會看到寬度屬性(可能是高度屬性)已經改變。我通過明確地設置身體的Site.css中的寬度來解決這個問題,如下所示:

body { 
    width:2000px; 
} 
相關問題