ASP.Net Core Razor global styles documentation

Sam of Simple Samples 5,466 Reputation points
2022-01-20T22:26:23.337+00:00

Where is the ASP.Net Core Razor documentation explaining how to reset a global CSS style to the HTML default style?

Razor uses Bootstrap for CSS and I might can find documentation (or at least articles) explaining how to reset a global CSS style to the HTML default style but I do not know if Razor has a different procedure for doing that. Whether it does nor does not, is there any relevant Razor documentation, at least something saying to use the relevant Bootstrap documentation?

I see Introduction to Razor Pages in ASP.NET Core. That thoroughly explains CSS isolation but says nothing about global styles. Since it is written as a tutorial it is reasonable for it to mention Bootstrap.

For me, I want to reset the size to the default for HTML. The font size in Bootstrap is:

--bs-body-font-size: 1rem;

Correct? And the rem size determines many other sizes, correct? I want to know where the documentation is that explains how to reset that size to the HTML default size.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,827 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 41,191 Reputation points
    2022-01-20T22:35:52.923+00:00

    Razor has nothing to do with app styling and therefore there is no documentation. ASP.NET templates use Bootstrap so if you are using the default template then overloading a Bootstrap style would be covered by the Bootstrap documentation as it isn't related to ASP.NET/Razor. The only "customization" that ASP.NET does is define a side-wide style CSS file where you can then add your custom styling that would be applied in addition to the Bootstrap styling.

    I'm not 100% sure but in CSS, to reset a rule to the default value then use the revert value. But note that revert simply undoes any styling changes to the current element. It might still inherit values from the parent. The initial resets a rule to the default value but I believe then ignores custom user styling as well which is not desirable. It also doesn't work for all properties. Finally you have the unset value which basically acts like revert or initial depending upon the type of property.