Home View specific css in Razor Pages with _Layout.cshtml

# View specific css in Razor Pages with _Layout.cshtml

CBreeze
1#
CBreeze Published in 2017-11-14 14:15:56Z
 I have a _Layout.cshtml file with a  secion that looks like so:  Dashboard  I have a View called Index.cshtml (that is using _layout.cshtml as a layout) with a  section that looks like so:   Now this line in Index.cshtml is styling my DataTables correctly, but it is messing up my layout page even though it is located in the Index.cshtml and not the _Layout.cshtml:   I must be getting a bit messed up with how my css is working throughout my web app. I have tried using @section but I couldn't get that to work either. So my question is how can I make the css in Index.cshtml only apply to that page rather than also affecting the css in _Layout.cshtml?
mxmissile
2#
 In your _layout use the RenderSection method with the required argument set to false:  .... @RenderSection("head",false)  Then in your view that requires additional css: @section head { }