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.
Thank you. I did consider submitting feedback and it helps to get verification that that would be appropriate.
I did just now discover that if I add
font-size: 14px;
to the html style in thewwwroot\css\site.css
file then that does reduce the font size. The article that helped me is What Are the Bootstrap 4 Text Font Sizes and How Do You Change Them? 2022 - Bootstrap Creative. Probably people experienced with Bootstrap and ASP.Net Core would say it is obvious that that should work but it was not obvious to me. When I searched for answers I just got very confused; I found stuff implying I had to re-compile stuff just to change the style. Microsoft tends to document stuff using tutorials and this is the type of thing that should be in a tutorial of ASP.Net Core Web Apps generated by VS (and/or the dotnet command).I posted feedback for Introduction to Razor Pages in ASP.NET Core and it was immediately closed; see Styling · Issue #24708 · dotnet/AspNetCore.Docs.
And changing the
font-size
in thesite.css
file is not enough; I need to change (reset) the font (font family) and that is not easy to determine how. I sure do not see how to do that in thesite.css
file.Hi @Sam of Simple Samples
From your description, it seems that you have found the right direction to solve the problem, whether the problem have been solved? If not, you can refer this sample to set the font-family in the site.css file:
Best regards,
Dillion
No, nothing yet has accomplished what I wanted. I should have clarified my question so that it asks about the application that VS generates. I find no relevant documentation of that. I thought that changing the font size would be enough but it is not. I eventually decided to just remove Bootstrap from the application; that was easier to do than expected. The relevant Microsoft personnel think they do not need to provide any assistance and I disagree so that makes it difficult to decide what the answer is.
Sign in to comment