Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS files loaded in Layout does not apply to Partial Views
    primarykey
    data
    text
    <p>I am linking a generic css file from my _ReportLayout file for my whole project, but for some reason it does not apply to my partial views! The css styles load just fine for the rendered body, but not the partial views inside it. (Examples given in the context of a report/journal writing system.)</p> <p>_ReportLayout:</p> <pre><code> &lt;head&gt; ... &lt;link href="~/Content/Report.css" rel="stylesheet" type="text/css" /&gt; &lt;/head&gt; </code></pre> <p>Rendered body:</p> <pre><code>@model JournalSystem.Models.Report @{ ViewBag.Title = "Write Report"; Layout = "~/Views/Shared/_Report.cshtml"; } @Html.Partial("~/Views/Journal/RapportSections/Title_Banner.cshtml", Model) &lt;h2&gt;More report entries...&lt;/h2&gt; </code></pre> <p>The partial view:</p> <pre><code>@model JournalSystem.Models.Report &lt;header&gt; &lt;h1 class="title"&gt; @Html.DisplayFor(r =&gt; r.SomeEntry.Name) &lt;/h1&gt; &lt;img class="logo" src="~/Images/Company_logo.png"/&gt; &lt;/header&gt; </code></pre> <p>What really confuses me is that styles written written directly with scripts tags in the _ReportLayout file <em>will</em> apply to the partial views, it just won't work with external style sheets.</p> <p>Can someone please help me on this one? I don't want to write the entire css inside script tags. :-)</p> <p><strong>Solved, see comments:</strong></p> <p>Reloading the entire project in Visual Studio seemed to be the solution - the CSS files edited in VS were not the ones uploaded to the page. Tips, update CSS files in the browser with CRTL+R (the files get cached). Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload