我在asp.net中有一个母版页。
以下是完整的.aspx文件。
使用bootstrap将CSS添加到div标签。所有链接都给出了。
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="apage.master.cs" Inherits="Website.apage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
<link href="Content/bootstrap.css" rel="stylesheet" />
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/jquery-3.1.1.min.js"></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="Panel_Main" style="box-shadow: 0 0 02px blue;" class="panel panel-primary">
<div id="Panel_Heading" class="panel-heading">
<table style="width: 100%;">
<tr>
<td>
<div class="text-left">
<h4 style="font-family: Calibri; font-size: xx-large; font-weight: normal; font-style: normal; font-variant: normal; color: #FFFFFF">MyWebsite</h4>
</div>
</td>
</tr>
</table>
</div>
<asp:ContentPlaceHolder ID="childContainer" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
我正在尝试使用子页面运行。但是css不适用于浏览器。
我有另一个配置相同的母版工作正常。但对于此页面,不会应用css。
我在这里遗漏了什么。
感谢任何帮助。
答案 0 :(得分:4)
试试这个
你的所有剧本&amp;所有Js写在 asp:ContentPlaceHolder
之外 <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<link href="Content/bootstrap.css" rel="stylesheet" />
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/jquery-3.1.1.min.js"></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="Panel_Main" style="box-shadow: 0 0 02px blue;" class="panel panel-primary">
<div id="Panel_Heading" class="panel-heading">
<table style="width: 100%;">
<tr>
<td>
<div class="text-left">
<h4 style="font-family: Calibri; font-size: xx-large; font-weight: normal; font-style: normal; font-variant: normal; color: #FFFFFF">MyWebsite</h4>
</div>
</td>
</tr>
</table>
</div>
<asp:ContentPlaceHolder ID="childContainer" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>