Project Technology Experience Summary 2: Distinguished System

xiaoxiao2021-03-06  37

In a system just completed, (based on ASP.NET) requires the system to provide a variety of style, users can choose the system style. We simply and effectively implement this feature by replacing the CSS style file. Implementation steps are as follows:

1. Define the CSS style file, you can be named Style_Blue.css, etc .: 2. Set the corresponding CSS in each program page (* .aspx) Set the CSS in the corresponding CSS. When the user logs into the style (value CSS file name, such as STYLE_BLUE) Use session to save 4. Go to the specific page, remove the CSS style from the session, load the corresponding CSS file (such as style_blue.css) on the file header (such as style_blue.css)

Of course, if you need a variety of styles, you need to prefably multiple CSS files.

Compare the color value of the page element in the database, then read it again, the advantages: the workload is less / no need to deal with the database multiple times (only when entering the system) CSS file name) Disadvantages: You cannot use the user's style of the page element. However, it is required to have a certain aesthetic basis by the user yourself. This disadvantage is generally not only in the application system.

Appendix 1: CSS style file A: LINK, A: ACTIVE, A: Visited {text-decoration: None; color: # 000000} A: Hover {text-decoration: underline; color: # 4455a} .selectedItem {Background-Color : # 8ac8df;} body {font-family: Verdana, Sans-Serif; Font-size: 9pt; Background-Color: # f6f6f6; scrollbar-face-color: # dee3e7; scrollbar-highlight-color: #fffff; scrollbar- shadow-color: # DEE3E7; Scrollbar-3dlight-color: # D1D7DC; Scrollbar-arrow-color: # 006699; Scrollbar-track-color: #EFEFEF; Scrollbar-darkshadow-color: # 98AAB1;} table_table {font-family. : Verdana, Sans-Serif; Font-Size: 9pt; Background-Color: # 4682b4} .table_head {font-family: Verdana, Sans-Serif; Font-size: 10pt; Background-Color: # C1D0E1; Color: #fffff Background-Image: URL (Blue.gif);} .table_strong {Font-Family: Verdana, Sans-Serif; Font-Size: 9pt; Background-Color: # 4682b4; color: #ffffff; font-weight: bold; } .Table_trline {font-family: vert-size: 9pt; background-color: # c1d0e1; height: 19pt; text-align: center; color: #ffff; font-weight: bold;} TR {Font-Family: Song; FONT- Size: 9pt; background-color: # f8f8f3; text-align: center} .t {line-heiGHT: 1.4} Div {font-family: Verdana, Sans-Serif; Font-size: 9pt;} form {font-family : Verdana, Sans-Serif; Font-Size: 8pt} Input; Color: # 000080; Background-Color: #EFEFEF} Input.ButtonFace {font-size: 9pt; color: # 000080; Background-Ski Color: # D2E9FF} Input.dialogbotton {font-size: 9pt; Color: RGB (0,0,128); Background-Color: RGB (255, 204, 51)}. Submit {font-size: 9pt; color: # 000080; Background -Color: # D2E9FF} textarea {border-width: 1; border-color: # 000000; Background-Color: #efefef; font-family: Song; Font-size: 9pt;} select {border-width: 1; border -color: # 000000; Background-Color: #ffff; font-family: Song; font-size: 9pt;} Option {Font-Family: Song; Font-size: 9pt;

background-color: #efefef} .Menu_Button {BORDER-BOTTOM: # 1864AE 1px solid; BORDER-LEFT: rgb (233,244,249) 0px solid; BORDER-RIGHT: # 1864AE 1px solid; BORDER-TOP: # 0051E7 0px solid; CURSOR: Hand; Background-Color: # 4682b4;}. Menu {font-size: 9pt; background-color: # 74a3c9;}. navpoint {cursor: hand; color: white; font-family: WebDings; Background-Color: # 4682b4 P {Font-Family: Verdana, Sans-Serif; Font-size: 9pt} br {font-family: Verdana, Sans-Serif; Font-size: 9pt} Appendix 2: Setting CSS in * .aspx page Class

> Appendix 3: Loading CSS file processing code (C #): protected override void render (HTMLTextWriter Writer) {// Output HTML Writer.writeline (""); Writer.writeLine (""); Writer.writeLine ("<

转载请注明原文地址:https://www.9cbs.com/read-56356.html

New Post(0)