如何在c#new literal中添加border bottom 1px [英] how to add border bottom 1px in c# new literal
问题描述
我正在尝试添加边框底部1 px的新文字,但是不要让它工作
var borderbotton = new Literal {Text = @ < ; border-bottom = 1px < / table};
您无法在Literal控件上添加任何Css样式。如果你需要在控件上应用样式,那么你应该使用控件来呈现任何html标签,但是文字控件不会呈现任何html标签,因此你将无法应用任何CSS样式。
ex。 < asp:标签 > - 这将呈现< span >
< asp:Panel > - 将呈现< 代码 > < div >
但是如果你的< asp:literal xmlns:asp =#unknown> < / asp:literal>
控件包含HTML字符串,然后您可以选择如何在页面上显示它。您可以使用它的模式
属性并从System.Web.UI.WebControls.LiteralMode
查看此链接以获取更多信息
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.mode.aspx [ ^ ]
i am trying to add new literal with border bottom 1 px but dont get it to work
var borderbotton = new Literal {Text = @"<border-bottom="1px"</table"};
You can not add any Css styles on Literal control. If you need to apply style on control then you should use control which render any html tag but literal control will not render any html tag so you won''t be able to apply any css style.
ex. <asp:Label> - which will render <span> <asp:Panel>- which will render <code><div>
But if your<asp:literal xmlns:asp="#unknown"> </asp:literal>
control contains HTML string then you have options how you want to display it on page. You can UseMode
property of it and set its value fromSystem.Web.UI.WebControls.LiteralMode
Checkout this link for more information
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.mode.aspx[^]
这篇关于如何在c#new literal中添加border bottom 1px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!