After several days of problem, I also saw a lot of solutions on the Internet. I thought it was a path problem, and finally I found it was a coding problem.
I copied the page created by the artist in Macromedia Dreamweaver 8 to the background of vs2005. The font and everything are displayed on the design interface, but they are not displayed when you browse the page.
Some methods collected on the Internet have been tried one by one. They are finally saved as HTML and then opened with Dreamweaver, and then compared with a new file, the encoding problem is found. Solution:
First, add
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
Configure in Web. config
<Globalization requestencoding = "gb2312" responseencoding = "gb2312"/>
Below are some of the methods described in an online article:
1. Incorrect CSS file path
This problem is a basic problem in Web development. Generally, this problem occurs when relative paths are used, or style files are written in the template page, this problem occurs when the content page and template page are not in the same directory. At this point, you need to know the relative path rules in the web. If you are not clear about the rules, you can try the absolute path method to see if it is a path problem.
2. Incorrect CSS rule writing
No one can help you with this problem. You can only learn CSS-related knowledge by yourself.
3. File Encoding Problems
Sometimes, CSS styles are valid in the aspx file but not in an independent file. If this problem is not caused by path problems, it is caused by encoding problems, you can open the CSS file in notepad, and then save it as ANSI or UTF-8 format.
4. Permission issues
In this case, the style is invalid before logon and is valid only after logon. This is caused by a typical permission problem. This problem occurs only when all files configured in Web. config do not allow anonymous access. The solution is to mark and configure the style file to allow anonymous access. For example:
The following is a reference clip:
<Configuration>
<Location Path = "Name of the folder that allows anonymous access">
<System. Web>
<Authorization>
<Allow users = "? "/>
</Authorization>
</System. Web>
</Location>
</Configuration>
5. The button style is invalid.
The most typical reason for this is that a statement such as response. Write exists in the click button event, because ASP. NET 2.0 uses begin by default. The solution to this problem is to use clientscriptmanager or literal control to output content.
6. the style that works in ASP. NET 1.x is invalid in ASP. NET 2.0.
This problem is still caused by xhtml1, because the limit must be written as width: 200px. The solution to this problem is to explicitly add the unit.
7. The style set by the script is invalid.
Because the xhtml1.dtd requires a unit, you still need to add the unit when setting the value of the object style, such as obj. style. width = "200px ". The following code is invalid in Firefox (do not complain about Firefox troubles)
The following is a reference clip:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<SCRIPT type = "text/JavaScript">
// <! [CDATA [
Function setheight ()
{
Document. getelementbyid ("X"). style. Height = "200"
}
//]>
</SCRIPT>
</Head>
<Body>
<Div id = "X" style = "Background: # DDD; Height: auto;"> test </div>
<Input type = "button" value = "set" onclick = "setheight ()"/>
</Body>
</Html>
Although the above is normal in IE, problems may occur in Firefox. The correct syntax is as follows:
The following is a reference clip:
Document. getelementbyid ("X"). style. Height = "200px"