0

我创建了一个 MVC 4 应用程序(Internet 模板)。它创建的主体是 1903px 宽 x 300px 高。在下图中,您可以看到它是如何渲染的。我没有看到指定宽度的任何地方,我很好奇它为什么决定创建 1903px 的宽度(和 300px 的高度)。

在此处输入图像描述

如果有帮助,主页的 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>
4

1 回答 1

0

I've just had exactly the same issue / question. It is setting the width based on the width of the browser window. If you make your window narrower and refresh the screen you will see that the width property (and probably the height property) have changed. I got around this by explicitly setting the width in the Site.css of the body as follows :

body {
    width:2000px;
}
于 2013-06-17T13:32:09.193 回答