CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    [RESOLVED] Assigning a stylesheet

    HI Guys,

    I've a Stylesheet in my webproject. I have assigned the stylesheet to my default page using <link...>. In the stylesheet I have several styles defined. I have a default one for a button for example and other custom ones. How do I assign a custom from my stylesheet against a particular button.

    i.e. I have 6 buttons 5 use the default style, but I want the 6th to have a different style.

    Thanks
    Last edited by Bill Crawley; February 16th, 2007 at 04:27 AM. Reason: narrow question
    If you find my answers helpful, dont forget to rate me

  2. #2
    Join Date
    Nov 2002
    Location
    Devon, UK
    Posts
    212

    Re: Assigning a stylesheet

    The Button has a CssClass property - put the class name from the css in there.

    HTH,
    T
    Some cause happiness wherever they go; others, whenever they go.

  3. #3
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Assigning a stylesheet

    Hi Toot,

    I've just tried that, but it makes no difference. I think a CssClass has to actually be written in code as opposed to using a stylesheet to set that property. i.e. Where the style is declared in the <Head> section of the page.

    Code:
    <head>
     
       <style>
     
           .CssStyle1   
           { 
               font: 12pt verdana; 
               font-weight:700;
               color:orange;
           }
     
           .CssStyle2
           { 
               font: 15pt times; 
               font-weight:250;
               color:blue;
           }
     
       </style>
    If you find my answers helpful, dont forget to rate me

  4. #4
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Assigning a stylesheet

    Apologies Toot, you are correct. I was referencing it incorrectly.
    If you find my answers helpful, dont forget to rate me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured