将样式放在带有母版页的页面中的位置

时间:2012-08-23 11:08:29

标签: html asp.net-mvc-3 xhtml xhtml-transitional

我有一个report.master

 <%@ Master Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewMasterPage" %>

 <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
 <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
 </asp:Content>

 <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ContentPlaceHolder ID="MainContent" runat="server" />
 </asp:Content>

 <asp:Content ID="Content3" ContentPlaceHolderID="SideBarContent" runat="server">

 <h2>Select Report</h2>
 <br />
 <ul>
 <li>
    <h2>JobSorted</h2>
    <ul style="text-align:left;">
        <li><%: Html.ActionLink("JobSorted Report Data", "JobSortedReportData")%></li>
        <li><%: Html.ActionLink("JobSorted Tradesmen Searches Data", "JobSortedTradesmenSearchesData")%></li>
        <li><%: Html.ActionLink("JobSorted Signup Summary Report", "JobSortedSignups") %></li>
        <li><%: Html.ActionLink("JobSorted Jobs Summary Report", "JobSortedJobs") %></li>
        <%--<li><a href="#">Subscription Report</a></li>--%>
    </ul>
    <h2>TradeUK</h2>
    <ul style="text-align:left;">       
        <li><%: Html.ActionLink("TradeUK KPI Searches Data", "TradeUKKPISearchesData")%></li> 
        <li><%: Html.ActionLink("TradeUK Job Searches Data", "TradeUKJobSearchesData")%></li> 
        <li><%: Html.ActionLink("Tradesman Signup Summary Report", "Index") %></li>
        <li><%: Html.ActionLink("Websites Report", "TradeUKWebsitesData")%></li>
        <li><%: Html.ActionLink("All Tradesman Counter Signup Summary Report", "AllTradesmenCodeRegistrations")%></li>
        <li><%: Html.ActionLink("Tradesman Counter Signup Summary Report", "TradesmenCodeRegistrations")%></li>
    </ul>
 </li>    
 </ul>

</asp:Content>

然后在我看来我有:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Report/Report.Master" Inherits="System.Web.Mvc.ViewPage<TradeUK.Admin.Web.ViewModels.KPIReportsViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
TradeUK KPI Searches Data
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<head>
<style type="text/css">
 .instructions
 {
    line-height:normal; 
 }
</style>
</head>

 <h2>TradeUK KPI Searches Data</h2>

<p>
   <%: Html.ActionLink("Export as CSV...", "TradeUKKPIDataExport", "Report", new {@date = ViewBag.jobSortedReportDate }, 0)%>    
 </p>
 </asp:Content>

我对头标记中的样式标记有警告。我必须把它放在哪里?我不明白?

感谢

1 个答案:

答案 0 :(得分:0)

在最终呈现的HTML样式中,应在<head>部分声明。您可以完全忽略在设计时获得的警告。如果您想要可靠的东西,请在此处验证最终生成的标记:http://validator.w3.org/