title: Use the same CSS file for masterpage and page content
body: <p>I have an APS.net app (C#) with several pages that use the same MasterPage. In that page, I have included a couple stylesheets like so:</p>
  
  <pre><code>&lt;head runat="server"&gt;
  &lt;link href="/apps/_lib/ui/styles1.css" type="text/css" rel="stylesheet" /&gt;
  &lt;link href="/apps/_lib/ui/styles2.css" type="text/css" rel="stylesheet" /&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>These styles apply correctly to all content that is in the actual .master file (page), but are not applied to any pages that use the Master page (for instance default.aspx uses that master page and has a Content placeholder in it).</p>
  
  <p>If I add these lines in each individual page:</p>
  
  <pre><code>&lt;link href="/apps/_lib/ui/styles1.css" type="text/css" rel="stylesheet" /&gt;
  &lt;link href="/apps/_lib/ui/styles2.css" type="text/css" rel="stylesheet" /&gt;
  </code></pre>
  
  <p>Then the styles show up as expected... but it was my hope that I could include them in the master page so that I didn't need to include these references in each subsequent page too.</p>
  
  <p>Because these files are not located physically in the same project (they are shared between several apps), i cannot just include them as an ASP.net theme that would be applied to all pages.</p>
  
  <p><strong>Update</strong></p>
  
  <p>In order to rule out the file locations problem, I used the absolute URL for these stylesheets...</p>
  
  <pre><code>&lt;link href="https://myserver/apps/_lib/ui/styles1.css" type="text/css" rel="stylesheet" /&gt;
  &lt;link href="https://myserver/apps/_lib/ui/styles2.css" type="text/css" rel="stylesheet" /&gt;
  </code></pre>
  
  <p>That way, no matter where it is read from, the file can be located. This still exhibits the same behavior.</p>
  
  <p>To me, it looks like the masterPage is rendered with the CSS styles (because they're in the same file) and then the child/calling page is rendered without the CSS styles (because they aren't in that file, they're in the masterPage) and then those two files are combined together (as opposed to combining them together first and THEN rendering the style elements for the combined pages). Adding to this belief was my previous example of adding the include for the CSS file in the calling page itself, which will cause it to display the CSS correctly.</p>
  
  <p>You can view the source of this file, and in the head section, you can see the CSS styles linked correctly, but they aren't applied to any elements from the calling page while they are applied to all elements in the masterPage.</p>