I’m just learning ASP.NET and I created the default Web App template in Visual Studio. There are some bootstrap.css files under wwwroot folder but even if I comment everything out it doesn’t have any effect on how the website looks like.
For example in _Layout.cshtml the @RenderBody method is wrapped up in div class="container"
but editing ".container" in the CSS files doesn’t do anything. It’s only when I delete the class name "container" in the div element something actually happens. So why editing these CSS files don’t have any effect?
2
Answers
The browser is likely caching bootstrap.css because it is linked into the page. Try opening dev tools in your browser and telling it to dump the cache and hard reload (if you are using chrome/edge, for example).
Some devs get around this by only opening their site in private mode or with debug/dev flags. FireFox even makes a developer edition of their browser too.
I think running your site using "dotnet watch" might also fix the issue.
Check your layout, what .css file you used. You can see it in the layout or using F12 to see it in the network.
Below is two options:
1.If you used the
bootstrap.min.css
in your layoutYou need comment
.container
in your bootstrap.min.css2.If you used
bootstrap.css
in your layoutYou need comment
.container
in your bootstrap.cssThe structure is like below: