Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to make label's text H1 by setting up a font property

How to make label's text H1 by setting up a font property

Scheduled Pinned Locked Moved ASP.NET
htmlsysadminarchitecturetutorialdiscussion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tina P
    wrote on last edited by
    #1

    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!

    A 1 Reply Last reply
    0
    • T Tina P

      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!

      A Offline
      A Offline
      Anurag Gandhi
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups