Do not define too much or define only one CSS file. According to the suggestions provided by my colleagues in the Web standard, the CSS of the Web application can be planned into four files:
(1) base.css
(2) from.css
(3) frame.css
(4) list.css
I don't want to introduce the significance of the above style file. (If the portal is not suitable for such planning)
To better apply these four CSS files. there are many other reasons, of course, when we set the code. it is best to set the base class of some pages. the following are four basic page classes that I usually use.
(1) pagebase. CS
(2) pagefrombase. CS
(3) pageframebase. CS
(4) pagelistbase. CS
The source code of pagebase. CS and pagelistbase. CS is provided here.
Public class pagebase: system. Web. UI. Page
...{
Protected override void oninit (eventargs E)
...{
Htmllink link = new htmllink ();
Link. Attributes. Add ("type", "text/CSS ");
Link. Attributes. Add ("rel", "stylesheet ");
Link. Attributes. Add ("href ","~ /App_common/styles/base.css ");
This. header. Controls. addat (1, link );
Base. oninit (E );
}
Public String key
...{
Get
...{
Return request. querystring ["key"];
}
}
} Public class pagelistbase: system. Web. UI. Page
...{
Htmllink link = new htmllink ();
Link. Attributes. Add ("type", "text/CSS ");
Link. Attributes. Add ("rel", "stylesheet ");
Link. Attributes. Add ("href ","~ /App_common/styles/list.css ");
This. header. Controls. addat (2, link );
Base. oninit (E );
}
Private int _ pageindex = 0;
Public int pageindex
...{
Get
...{
Return _ pageindex;
}
Set
...{
_ Pageindex = value;
}
}
Private int _ pagesize = 16;
Public int pagesize
...{
Get
...{
Return _ pagesize;
}
Set
...{
_ Pagesize = value;
}
}