In the CSS file make sure that your class name starts with a "." (decimal or period) as that means that it is a class usuable anywhere on your site.
John
Main Topics
Browse All TopicsHi,
I am new to CSS and ASP.NET
I am using Visual Studio 2005 to create the webpage, and using the defualt button fromt he Visual Studio 2005 which generate the code as below
<asp:Button ID="Button1" runat="server" Text="Filter"/><br />
Now, the problem is, what to put inside the code and also the CSS in order for me to use the same style everytime?
I would like to change the background of the button into #333333 with white bold font.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
righ-click your project, Add new Item. select Style Sheet. add this to your new css file and save.
.buttonStyle{
color:#FFFFFF;
font-family:verdana;
font-size:84%;
font-weight:bold;
background-color:#333333;
}
on your page, go to Source view,
add <link href=StyleSheet.css media=screen type="text/css" /> within the <head> tag
assign the style to your button
<asp:Button ID="Button1" runat="server" Text="Filter" cssclass="buttonStyle"/>
Business Accounts
Answer for Membership
by: j-w-thomasPosted on 2007-09-01 at 07:42:24ID: 19813949
Hi cybeh,
In the CSS file add a name for the button class (you r choice) and then the attributes as you show:
.RegularButton {
background-color:#333333;
color:#FFFFFF;
font-weight:bold;
}
Then add in this to the button tag:
<asp:Button ID="Button1" runat="server" Text="Filter" CssClass="RegularButton" />
I also believe that in the button attributes right in the Visual Studio it has a place to add on the CSS class.
Hope that this helps.
John