如何突破页面宽度限制

时间:2016-12-07 21:02:02

标签: html css

非常简单,我希望ASP.NET页面占据屏幕的整个宽度。 100%不是100%,我已经尝试了很多建议而且都失败了。我确信这是一行简单的代码,但我似乎并没有碰到它。

如果你需要代码片段,请告诉我,但我认为这不会有帮助。

感谢。

enter image description here

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="mytestsite.com.Site1" %>
<!DOCTYPE html>
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %></title>

<webopt:bundlereference runat="server" path="~/Content/css"/>
<link   href="~/Content/bootstrap.css"      type="text/css" rel="stylesheet"/>
<script src="~/Scripts/jquery-2.2.4.min.js" type="text/js"></script>
<script src="~/Scripts/bootstrap.js"        type="text/js"></script>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />

<asp:PlaceHolder runat="server">
    <%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
</head>
<body style="resize:both; margin:0%; height:100%; width:100%;">
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" ScriptMode="Release" LoadScriptsBeforeUI="true">
<Scripts>
<%--Framework Scripts--%>
            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="bootstrap" Path="~/Scripts/bootstrap.js" />
            <asp:ScriptReference Name="respond" />
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
            <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
            <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
            <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
            <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
            <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
            <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
            <asp:ScriptReference Name="WebFormsBundle" />
            <%--Site Scripts--%>
        </Scripts>
    </asp:ScriptManager>

    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" runat="server" href="~/"></a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a runat="server" href="~/">Return to My Test Site Home</a></li>
                    <li><a runat="server" href="~/">Bin Shredding - Overview</a></li>
                    <li><a runat="server" href="~/">Facility Questionnaire</a></li>
                    <li><a runat="server" href="~/">Bin Shredding FAQ</a></li>
                </ul>
                <p class="nav navbar-text navbar-right"></p>
            </div>
        </div>
    </div>
    <div class="container body-content">
        <asp:ContentPlaceHolder ID="MainContent" runat="server">
        </asp:ContentPlaceHolder>
        <hr />
        <footer>
            <p>&copy; <%: DateTime.Now.Year %> - My Test Site</p>
        </footer>
    </div>

</form>

DOM捕获,根据请求。

enter image description here

1 个答案:

答案 0 :(得分:2)

看起来你正在使用bootstrap。在html标记中,你有一个带有类容器的div。如果你看一下bootstrap css,你会看到附加了一个样式,表示最大宽度,可能是1170px之类的东西。存在各种值和/或可以在下载引导程序包时自定义它。

更改容器类的最简单方法是将容器类更改为container-fluid。也可以编辑css文件并进行更改,但这很复杂,因为有许多不同的媒体查询,其中定义了.container的最大宽度。