How to make label's text H1 by setting up a font property
-
Ok guys, so this one is sort of hard to describe, but here it is...I have a label inside a div. The div tag has a style element which is setting up fonts and stuff like that on the label....the text of the label is set somewhere else, it's a separete mechanism similar to resx files...so I can't just simply say <h1> Blah blah </H1>...so I need to set some property either on the label itself, or on the div tag that can display the text as H1 heading. This is what it has in the style attribute of the div <pre><div style="margin: 0px; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 11px; font-style: normal; font-variant: normal; border-bottom: white 5px solid;"> <asp:Label ID="lblMyLabel" Font-Bold="True" runat="server" /> </div></pre> I know it's gotta be pretty simple, but i can't seem to find the right property to set either on the div or on the label which will convert the text size to H1. I realize that i can accomplish the same using font size or somethihng else, but they want to be able to see <h1> tag around the text of this label, when viewing the view source (rendered html). Any thoughts please!
-
Ok guys, so this one is sort of hard to describe, but here it is...I have a label inside a div. The div tag has a style element which is setting up fonts and stuff like that on the label....the text of the label is set somewhere else, it's a separete mechanism similar to resx files...so I can't just simply say <h1> Blah blah </H1>...so I need to set some property either on the label itself, or on the div tag that can display the text as H1 heading. This is what it has in the style attribute of the div <pre><div style="margin: 0px; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 11px; font-style: normal; font-variant: normal; border-bottom: white 5px solid;"> <asp:Label ID="lblMyLabel" Font-Bold="True" runat="server" /> </div></pre> I know it's gotta be pretty simple, but i can't seem to find the right property to set either on the div or on the label which will convert the text size to H1. I realize that i can accomplish the same using font size or somethihng else, but they want to be able to see <h1> tag around the text of this label, when viewing the view source (rendered html). Any thoughts please!
Well, h1 is a tag not a property. so you cannot set it to your Label control. I could suggest the following: 1. Instead of Label, use h1 tag with runat="server" and a unique id. Then you can access and change the header from you code behind.
//In aspx page:
<h1 id="MyHeader" runat="server"></h1>
//in your code file(C#):
MyHeader.InnerHtml = "Blah Blah Blah...";2. Instead of using Label, use Literal Control and form the tag from where ever in code behind you want. Hope this will help.
Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.