Search code examples
htmlasp.net-mvc-3xhtmlxhtml-transitional

where to put styles in page with a master page


I have a 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>

then in my view I have:

<%@ 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>

I have a warning about the style tag within the head tag. Where must I put this? i dont understand?

thanks


Solution

  • In your final rendered HTML styles should be declared in the <head> section. You can completely ignore the warnings that you are getting during design time. If you want something reliable validate your final generated markup here: http://validator.w3.org/