Given: Bootstrap 5.1 VS 2022 Pro Blazor Server App
How can I make the container take up entire screen no margins all around?
<div class="container bg-primary"> Hello World! </div>
This is what that currently looks like:
2
I think you may be looking for the "container-fluid" class instead of "container".
Try this:
<div class="container-fluid bg-primary"> Hello World! </div>
Docs: https://getbootstrap.com/docs/5.0/layout/containers/
Modify the last section of mainLayout.razor.css to:
@media (min-width: 641px) { .page { flex-direction: row; } .sidebar { width: 250px; height: 100vh; position: sticky; top: 0; } .top-row { position: sticky; top: 0; z-index: 1; padding-left: 2rem !important; padding-right: 1.5rem !important; } article { height:100vh; } }
MainLayout.razor:
<div class="page"> <div class="sidebar"> <NavMenu /> </div> <main> <div class="top-row px-4"> <a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a> </div> <article class="content ps-0 pt-0"> @Body </article> </main> </div>
In your target component:
<div class="container-fluid bg-primary" style="height:100vh"> Hello World! </div>
Result:
Click here to cancel reply.
2
Answers
I think you may be looking for the "container-fluid" class instead of "container".
Try this:
Docs: https://getbootstrap.com/docs/5.0/layout/containers/
Modify the last section of mainLayout.razor.css to:
MainLayout.razor:
In your target component:
Result: