[英]how can I remove left and right margin from my default.aspx
how can I remove the left and right margin from my default.aspx.如何从我的 default.aspx 中删除左右边距。 I have tried to change the bootstap.cs but in vain.
我试图更改 bootstap.cs 但徒劳无功。 I am using just a standard template from the visual studio webapplication having standard default.aspx.
我仅使用来自具有标准 default.aspx 的 Visual Studio Web 应用程序的标准模板。 But the problem that lot of space is left on the right side for the menu and for the page as well.
但问题是菜单和页面的右侧也留有大量空间。 The picture shows the required result.
图片显示了所需的结果。 Code is for site.master is below.
代码用于 site.master 如下。 I have just pasted but again it is standard in the visual studio.
我刚刚粘贴了,但它再次在视觉工作室中是标准的。 So the same reference can be taken.
因此可以采用相同的参考。
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="WebApplication1.SiteMaster" %> <!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 %> - My ASP.NET Application</title> <asp:PlaceHolder runat="server"> <%: Scripts.Render("~/bundles/modernizr") %> </asp:PlaceHolder> <webopt:bundlereference runat="server" path="~/Content/css" /> <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> </head> <body> <form runat="server"> <asp:ScriptManager runat="server"> <Scripts> <%--To learn more about bundling scripts in ScriptManager see https://go.microsoft.com/fwlink/?LinkID=301884 --%> <%--Framework Scripts--%> <asp:ScriptReference Name="MsAjaxBundle" /> <asp:ScriptReference Name="jquery" /> <asp:ScriptReference Name="bootstrap" /> <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" title="more options"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" runat="server" href="~/">Application name</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a runat="server" href="~/">Home</a></li> <li><a runat="server" href="~/About">About</a></li> <li><a runat="server" href="~/Contact">Contact</a></li> <li><a runat="server" href="~/Contact">Hello</a></li> </ul> </div> </div> </div> <div class="container body-content"> <asp:ContentPlaceHolder ID="MainContent" runat="server"> </asp:ContentPlaceHolder> <hr /> <footer> <p>© <%: DateTime.Now.Year %> - My ASP.NET Application</p> </footer> </div>
You can just make a utility class or just directly add the following class to the elements.您可以只创建一个实用程序类,也可以直接将以下类添加到元素中。
Add this inside your
Head
tag将此添加到您的
Head
标记中
<style>
.rm-margin{
margin-left: 0 !important;
margin-right: 0 !important;
}
</style>
!important
would override any bootstrap stylings. !important
将覆盖任何引导样式。
Add the
rm-margin
to the div you want将
rm-margin
添加到您想要的 div
You can just change below lines您可以更改以下行
<div class="navbar navbar-inverse navbar-fixed-top rm-margin">
<div class="container body-content rm-margin ">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.