Styling server controls with a stylesheet
A server control is not a mysterious object in the browser. It renders as ordinary markup, and that markup can be styled with a stylesheet like anything else.
Give a control a class
Markup
<asp:Button id="btnSave" runat="server"
Text="Save" CssClass="actionButton" />CSS
.actionButton {
padding: 10px 16px;
background: #2c5743;
color: #ffffff;
border: 0;
}Why a stylesheet beats inline styling
- One change updates every page that uses the class.
- The markup stays about structure and the stylesheet stays about appearance.
- You can restyle the whole site without touching a single page.
Look at the rendered output. Run the page and view the source the browser received. Seeing the real markup is the quickest way to understand how a control renders.
As the site grows you will add pages. That is adding a new page to the site.