简体   繁体   English

如何以编程方式添加悬停样式C#ASP.net

[英]How to programatically add a hover style C# ASP.net

So I'm aware that to add a "regular" style to an object in asp you use: 因此,我知道您可以在使用asp的对象中添加“常规”样式:

object.Style.Add("background-color", "red");

Is there any way to add a style but with the :hover selector? 除了:hover选择器,是否可以添加样式? Can't find any useful info skimming the web. 浏览网页时找不到任何有用的信息。

Thanks a lot! 非常感谢!

You can't do this with the :hover selector. :hover选择器不能做到这一点。 The :hover pseudo selector can't be applied/used in inline-styles. :hover伪选择器不能以内联样式应用/使用。 object.Style applies inline styles. object.Style应用内联样式。 You should be using stylesheets anyway and not inline styles. 无论如何,您都应该使用样式表,而不是内联样式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM