Well, if you want a quick but effective answer, I will share my opinion on how to use CSS files and CSS in general, this is not related to controls or ASP.NET language.
First of all, ask the graphic designer to give you an idea of ββwhat the website looks like. : the position of each element (menu, logo, content), the appearance of each element (color? image, if necessary?) and, possibly, the most important, uniform font family and colors throughout the site: there may be several colors, but more than three or four gets too dirty and noisy.
With a sketch, start by placing empty placeholders (or with dummy text) on the page and give each one its own class, where you later determine how the contents of the placeholder will look. You can also use the placeholder element identifier later if you are sure that its design is unique and will not be "shared" by other elements.
The "heart" of all this makes everyone manifest themselves, as in a sketch, determining the correct style. For example, if you need a menu on the right with links in a specific color and content on the left, all you need in the HTML part (.aspx or .ascx in your case) is this:
<div id="MainContents">contents here</div> <div id="MainMenu">menu links come here</div> <div class="clear"></div>
Then in the CSS file:
#MainContents { float: left; width: 700px; padding: 10px; } #MainMenu { float: right; width: 300px; padding: 5px; } #MainMenu a { color: #e01010; } .clear { clear: both; }
The "hidden" part is required when using float, just an empty div with a clear: both styles.
Something about this, in a very shallow short ... I will talk about a specific part if you want.
As for ASP.NET controls, if more than one control uses the same CSS file and that the CSS file is not βglobalβ for all pages, you can use this code to include the CSS file only once:
if (!Page.ClientScript.IsClientScriptBlockRegistered(this.Page.GetType(), "MyCssFile")) Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "MyCssFile", "<link href=\"MyCssFile.css\" rel=\"stylesheet\" type=\"text/css\" />", false);
This code placed in the Page_Load of the control will only contain the CSS file once, even if there are 20 instances of the control on this page.