如何在Blazor中直接更改CSS(无变量)? [英] How can I change css directly(without variable) in Blazor?

查看:78
本文介绍了如何在Blazor中直接更改CSS(无变量)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Blazor的服务器端.

I am using the server-side of Blazor.

我想更改身体的CSS.

I want to change the CSS of the body.

在Jquery中,我可以轻松地编写如下代码:

In Jquery I can write the code like this easily:

$("body").css("overflow-y","hidden");

但是,在本教程中( Blazor Change Validation默认CSS类名称)说,看来我只能通过更改类名来更改CSS.

However, with this tutorial(Blazor Change Validation default css class names) said, it seems I can only change the CSS by changing the class name.

在穿过组件时非常复杂,尤其是身体在所有组件的顶部.

It is so complex while crossing the component, especially the body is at the top of all the components.

我想知道是否有一种方法可以直接在Blazor中更改CSS.谢谢.

I wonder whether there is a way can changes CSS directly in Blazor. Thank you.

推荐答案

Blazor尚不支持直接CSS修改,因为Web Assembly不支持.无论如何,它在Web Assembly/Blazor的路线图上.

Well, Blazor does not support direct css modification yet, since Web Assembly doesn't. Anyway heads up, it is on the road-map for Web Assembly/Blazor.

因此,最好的选择是使用变量更改类名称.至少现在是这样.

Therefor your best bet is, changing the class name with variables. At least for now.

这篇关于如何在Blazor中直接更改CSS(无变量)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆