I recently posted some CSS and HTML snippets for a buttons collection I was using for a Menu style UI Scott Koon from www.LazyCoder.com posted a comment with a better way (thanks Scott). This way I don’t have to set the CSS Class for each button. Just contain them in a div. Here is the CSS

CSS
  1. div input:hover
  2. {
  3. background-color: #BFCBD6;
  4. }
  5.  
  6. div input
  7. {
  8. vertical-align: middle;
  9. text-align:center;
  10. width: 150px;
  11. height: 40px;
  12. border: 1;
  13. border-color: Silver;
  14. background-color: #465C71;
  15. color: White;
  16. }

And here is the markup.

ASP.NET Markup
  1. <%@ Page Title="Home Page" Language="C#"
  2. MasterPageFile="~/Site.master"
  3. AutoEventWireup="true"
  4. CodeBehind="Default.aspx.cs"
  5. Inherits="Button_CSSSelector._Default" %>
  6. <asp:Content ID="HeaderContent" runat="server"
  7. ContentPlaceHolderID="HeadContent">
  8. </asp:Content>
  9. <asp:Content ID="BodyContent" runat="server"
  10. ContentPlaceHolderID="MainContent">
  11. <div style="text-align: center;">
  12. <h2>Administration</h2>
  13. </div>
  14. <hr /><br />
  15. <div style="text-align: center;">
  16. <asp:Button ID="btnAdminUsers" runat="server"
  17. Text="List Users"
  18. PostBackUrl="" />
  19. &nbsp;&nbsp;
  20. <asp:Button ID="btnAdminActivate" runat="server"
  21. Text="Inactive Users"
  22. PostBackUrl="" />
  23. &nbsp;&nbsp;
  24. <asp:Button ID="btnAdminEvents" runat="server"
  25. Text="Locked Out Users"
  26. PostBackUrl="" />
  27. &nbsp;&nbsp;
  28. <br /><br />
  29. <asp:Button ID="btnAdminRoles" runat="server"
  30. Text="Roles"
  31. PostBackUrl="" />
  32. &nbsp;&nbsp;
  33. <asp:Button ID="btnAdminAccess" runat="server"
  34. Text="Access Security"
  35. PostBackUrl="" />
  36. &nbsp;&nbsp;
  37. <asp:Button ID="btnAdminSettings" runat="server"
  38. Text="Application Settings"
  39. PostBackUrl="" />
  40. &nbsp;&nbsp;
  41. <asp:Button ID="btnAdminReporting" runat="server"
  42. Text="Reporting"
  43. PostBackUrl="" />
  44. &nbsp;&nbsp;
  45. <asp:Button ID="btnAdminMisc" runat="server"
  46. Text="Misc"
  47. PostBackUrl="" />
  48. &nbsp;&nbsp;
  49. </div>
  50. </asp:Content>