以编程方式向figcaption添加font-weight

时间:2017-01-06 23:41:37

标签: asp.net

如何以编程方式将font-weight粗体添加为<figcaption>

我试过了:

HtmlGenericControl figCap = new HtmlGenericControl("figcaption");
figCap.Attributes.Add("font-weight", "bold");

1 个答案:

答案 0 :(得分:0)

您需要.Style.Add("font-weight", "bold"),因为.Attributes.Add("font-weight", "bold")只会创建<figcaption font_weight="bold">...