简体   繁体   中英

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:

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

Is there any way to add a style but with the :hover selector? Can't find any useful info skimming the web.

Thanks a lot!

You can't do this with the :hover selector. The :hover pseudo selector can't be applied/used in inline-styles. object.Style applies inline styles. You should be using stylesheets anyway and not inline styles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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