problem with style sheets

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinod allapu
    New Member
    • Apr 2009
    • 28

    problem with style sheets

    Hi boss,

    I am adding style sheets in my project . I have created a style for labels.
    I linked it to my web page and used. Now the problem is for the first page load , my style sheet attributes are applying. If i select some option in the page and submit , the styles of labels are changing....

    Can anybody help me in solving this problem. Style i used for labels is
    Code:
    .labelStyle
    {
    	font-family: 'Times New Roman' , Times, serif;
    	font-size: medium;
    	font-weight: bolder;
    	font-variant: normal;
    	color: Background;
    	margin: 10px;
    	text-transform: none;
    }
    In the aspx page i used like
    Code:
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    
    <asp:Label ID="lbAdmissionNumber" runat="server" CssClass="labelStyle" Text="<%$ Resources:Resource,  AdmissionNumber %>"></asp:Label></td>
    I will be thankful to you if you tell how to apply stylesheet to labels in webusercontrol page.


    Thanking you boss,
    Last edited by Frinavale; May 13 '09, 01:15 PM. Reason: Added code tags. Please post code in [code] [/code] tags.
  • shiznit770
    New Member
    • Apr 2009
    • 10

    #2
    What do the option being selected and button being clicked do?

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by vinod allapu
      Hi boss,

      I am adding style sheets in my project . I have created a style for labels.
      I linked it to my web page and used. Now the problem is for the first page load , my style sheet attributes are applying. If i select some option in the page and submit , the styles of labels are changing....
      ...

      Thanking you boss,
      Hi Vinod Allapu,

      You need to add the link for the style sheet to the head section of your aspx page:
      Code:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head id="Head1" runat="server">
          <title></title>    
      <!-- Added link to style sheet here -->
          <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
      </head>
      <body>
          <form id="Form1" runat="server" autocomplete="off" style="height:100%;width:100%;">

      You should not have any problem applying any of the classes defined in the style sheet to your Labels (or other elements).

      Your style is invalid though so this might explain why it's not working for you. You cannot set the color: Background. You need to set it to some color:

      Code:
      .labelStyle
      {
      	font-family: 'Times New Roman' , Times, serif;
      	font-size: medium;
      	font-weight: bolder;
      	font-variant: normal;
      //will set the text color to red
      	color: #C00000;
      //will set the background color to Green
              background-color: #009900;
      	margin: 10px;
      	text-transform: none;
      }

      Originally posted by vinod allapu
      If i select some option in the page and submit , the styles of labels are changing...
      Are you using Ajax on the page?


      Cheers!

      -Frinny

      Comment

      Working...