Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To style a Blazor task tracker with Bootstrap, first identify whether it is a Blazor Web App or a standalone WebAssembly app and which .NET version it targets. Then use Bootstrap classes for common interface elements, keep shared framing in the app layout, and put task-list-specific rules in the component’s collocated stylesheet. Static stylesheet paths differ by app type and framework version, so don’t copy a link tag without checking the project.

Start with the project type and template

For new Blazor development on .NET 8 or later, Microsoft recommends the Blazor Web App template. Its template options affect the starting point: non-empty variants include sample pages and Bootstrap styling, while empty variants omit the sample pages and Bootstrap styling. If you are working in an existing task tracker, identify its project type and target framework before changing its styling setup.

A standalone WebAssembly app is a different project type. The non-empty standalone WebAssembly template includes the Bootstrap frontend toolkit, but that does not mean every Blazor project has the same template files or asset references. See Microsoft’s Blazor tooling and template guidance and project structure documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Separate the shared shell from task-tracker styling

Put app-wide structure in the layout

MainLayout is the conventional default layout for a Blazor app. Use it for elements shared across pages, such as the overall page frame and shared navigation. Its collocated MainLayout.razor.css file is the conventional place for layout-specific styles. Microsoft’s documented layout uses Flexbox for its structure; that is a useful pattern for arranging a navigation area and page content without tying task-specific rules to the whole app.

Keep task-list rules with the component

Put markup for a task list in its component and styles that belong only to that component in a collocated stylesheet named after it, such as TaskList.razor.css. Blazor CSS isolation scopes those rules to the component when the app is built. This keeps product-specific details—such as task-row spacing or a completed-task treatment—from unintentionally changing other pages.

Use Bootstrap classes in the markup for familiar interface patterns, then add narrowly scoped CSS for visual details the framework classes do not express. For example, a task tracker may use Bootstrap utilities for spacing, buttons for actions, and labels for status, while its component stylesheet handles its own hierarchy and responsive adjustments. These are implementation choices, not a prescribed design from Microsoft. See the Blazor layouts guidance and CSS isolation documentation.

Reference stylesheets for the right app and .NET version

Static stylesheet paths depend on both the app type and framework version. For .NET 9 or later, Microsoft documents the @Assets["{PATH}"] convention for a Blazor Web App. A standalone WebAssembly app uses a relative path, such as css/app.css. Treat those as distinct conventions rather than interchangeable link-tag examples: confirm the target framework and project structure before editing the stylesheet reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Static assets are served from the web root, but their exact placement and reference depend on the project. Consult Microsoft’s Blazor static files documentation for the relevant app type and version.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Build component styles in the right order

If you author component styles in Sass or Less, compile the preprocessor source before Blazor performs CSS isolation’s selector rewriting. The order matters: Blazor needs the compiled stylesheet to apply its component scoping. CSS isolation is a build-time mechanism, not a substitute for deciding which rules belong to the shared layout and which belong to an individual component.

Choose the styling approach that fits the project

  • Existing project: Preserve its app type, target framework, template structure, and asset conventions; add styling within those constraints.
  • New project with a styled starting point: Choose a non-empty template when its sample pages and Bootstrap-based styling are useful.
  • New project with a clean starting point: Choose an empty template if you want to establish the markup and styling yourself.
  • Shared page framing: Use MainLayout and its stylesheet for structure that spans pages.
  • Task-specific presentation: Use the task component and its collocated .razor.css file for isolated rules.
  • Stylesheet references: Follow the static-asset convention for the app type and .NET target rather than assuming a path from another Blazor project applies.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.