I want to adding style to asp.net label, but it wont work.
ASP.NET Mark up
<asp:Label runat="server" ID="lblCommentText"/>
Generated from the backend: Html mark up
<span id="ctl02_ctl36_CommentText">Only the leave the comment please</span>
............................................
I want to add the following style to the label
{
float:right;
width:70%;
}
I've tried using
cssClass property
Add this
lblCommentText.Attributes.CssStyle.Add("float", "right");to backendusing javascript
document.getElementById('<%= lblCommentText.ClientID%>').Style.display = ("float","right");and also in-line style to the element
none of them works, can someone help me out ?
display: inline-block;.classand apply that class with theCssClassproperty on theLabel.