Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background and textcolor navbar Blazor

I would like to change the background color of a navbar in Blazor, but I cannot find the way to do it. It cannot be that difficult, I guess. Can anybody tell me?

<div class="top-row pl-4 navbar navbar-dark bg-primary ">
    <a class="navbar-brand bg-primary" href="">Test</a>
    <button class="navbar-toggler bg-primary" @onclick="ToggleNavMenu">
        <span class="navbar-toggler-icon bg-primary"></span>
    </button>
</div>

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
    <ul class="nav flex-column">
        <li class="nav-item px-3 bg-primary">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <span class="oi oi-home" aria-hidden="true"></span> Home
            </NavLink>
        </li>
        <li class="nav-item px-3 bg-primary oi-resize-height">
            <NavLink class="nav-link" href="hd">
                <span class="oi oi-list-rich" aria-hidden="true"></span> hd
            </NavLink>
        </li>
    </ul>
</div>
like image 664
Pipsy100 Avatar asked May 05 '20 10:05

Pipsy100


People also ask

How do I change the background color of my navigation bar?

Use any of the . bg-color classes to add a background color to the navbar. Tip: Add a white text color to all links in the navbar with the . navbar-dark class, or use the .

How do I make a navbar transparent?

Creating a transparent navbar is very easy - just don't add a color class . bg-* to the navbar. In this case, the Navbar will take the color of the parent's background color.

How do I change the color of my navbar font?

The text color of the navigation bar can be changed using two inbuilt classes: navbar-light: This class will set the color of the text to dark. This is used when using a light background color. navbar-dark: This class will set the color of the text to light.

What color is navbar-dark?

Use navbar-dark for lighter text color (white), or navbar-light for darker text color (black).

How to fix Blazor sidebar color not changing in dark mode?

If we open our sidebar and switch to dark mode, we are going to see that the sidebar’s color is not changing. To fix that, we have to add three more properties to the Pallete object: We can see, we apply it on the sidebar too. Right now, we have a working Blazor material navigation menu but, we can improve our code.

How to add background color to the main class?

You can add background color with inline CSS in main class the color as per your choice like this in MainLayout.razor.

How does mudblazor convert palette colors to classes?

Each palette color gets converted to a class with the color as background and its contrast, but also separate classes for only background or text color. The CSS class is bound to the MudBlazor theme and updated if you change the theme dynamicly. You can read more about theming MudBlazor here.

How do I create a right-aligned vertical style bar in blazorise?

For a demo of the Vertical bar in action, please check out this Blazorise demo. You can create a right-aligned Vertical style Bar easily by following two key principals. Using the Layout to accommodate the right-align bar, by putting the LayoutSider section after the Layout section (see in example below).


Video Answer


2 Answers

In "MainLayout.razor"

<div style="background-image:none;background-color:cadetblue;" class="sidebar">
    <NavMenu />
</div>
like image 175
冷面包 Avatar answered Sep 28 '22 00:09

冷面包


Late answer I was reviewing first posts. In app.css in the client change the sidebar class :

.sidebar {
    background-color: orange;
}
like image 32
Brian Parker Avatar answered Sep 27 '22 23:09

Brian Parker