CSS and Button Server Controls


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: CSS and Button Server Controls

  1. #1
    Al Mowbray Guest

    CSS and Button Server Controls


    I have a CSS (Styles.css) with an added "Button" element in the sheet with
    some formatting attributes. When I link the style sheet to the web form
    and add a button to the web form, the listed attributes are not applied to
    the button - I just get the standard gray button. If I make changes to the
    body in the style sheet, such as background color, etc. these changes are
    immediately reflected in the form.

    BUTTON
    {
    font-weight: bold
    color: aqua
    }

    I would like to specify a button style to use throughout the web application
    without having to set the properties each time for each button.

    Thanks for the help.

    Al Mowbray

  2. #2
    Constance J. Petersen Guest

    Re: CSS and Button Server Controls

    Hi Al,

    You can set just the cssclass property for the buttons to name the css class,
    and then define it in your external stylesheet. For example:

    <asp:Button id=myButton runat="server" Text="Click Me"
    cssclass="btn"></asp:Button>

    and

    ..btn
    {
    font-weight: bold;
    color: aqua;
    }

    Or, some browsers (Netscape 6, for example, but unfortunately not MSIE) support
    attribute selectors, allowing you to skip setting the cssclass property for each
    button:

    input[type="submit"]
    {
    font-weight: bold;
    color: aqua;
    }

    --
    Constance Petersen, DevX newsgroup section leader
    Build a great Web site: http://www.smartisans.com/
    Learn ASP.NET: "Programming the Web with Visual Basic .NET"
    http://amazon.com/exec/obidos/ASIN/1...tancepeterseA/
    --
    Please reply in the newsgroup so everyone can benefit


    "Al Mowbray" <amowbray@charter.net> wrote in message
    news:3e238b80$1@tnews.web.devx.com...
    >
    > I have a CSS (Styles.css) with an added "Button" element in the sheet with
    > some formatting attributes. When I link the style sheet to the web form
    > and add a button to the web form, the listed attributes are not applied to
    > the button - I just get the standard gray button. If I make changes to the
    > body in the style sheet, such as background color, etc. these changes are
    > immediately reflected in the form.
    >
    > BUTTON
    > {
    > font-weight: bold
    > color: aqua
    > }
    >
    > I would like to specify a button style to use throughout the web application
    > without having to set the properties each time for each button.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center