最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net core - How do I make a Text Bold in the Mudblazor? - Stack Overflow

programmeradmin1浏览0评论

I am working with MudBlazor and I’ve noticed that it has many frontend classes, such as Typo and Align. I want to make text bold without using any external CSS or the <b> tag. For example, I have the following code: <MudText Typo="Typo.h1" Align="Align.Start">Welcome Back</MudText>.

How can I achieve that? Thank you!

I want it to be bold.

I am working with MudBlazor and I’ve noticed that it has many frontend classes, such as Typo and Align. I want to make text bold without using any external CSS or the <b> tag. For example, I have the following code: <MudText Typo="Typo.h1" Align="Align.Start">Welcome Back</MudText>.

How can I achieve that? Thank you!

I want it to be bold.

Share Improve this question edited Feb 24 at 5:53 Qiang Fu 9,4171 gold badge6 silver badges16 bronze badges asked Feb 21 at 5:42 Aaron SharonAaron Sharon 134 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

<b>is the official documented way so no other built-in class. Or you could just do inline style

<MudText Typo="Typo.h1" Align="Align.Start" Style="font-weight:bold">Welcome Back</MudText>

Or you could override the default "h1" typo in MudThemeProvider. By creating mud blazor template you should have following code in MainLayout.razor

<MudThemeProvider Theme="@_theme" IsDarkMode="_isDarkMode" />

At below code you could override h1 like this

    private MudTheme? _theme = null;

    protected override void OnInitialized()
    {
        base.OnInitialized();
        _theme = new()
        {
            PaletteLight = _lightPalette,
            PaletteDark = _darkPalette,
            LayoutProperties = new LayoutProperties(),
            Typography = new Typography()
            {
                H1 = new H1()
                {                                 
                    FontWeight = 900
                },

            }
        };
    }

Then all the Typo.h1 will be bold without other configuration.

发布评论

评论列表(0)

  1. 暂无评论