The solution of CSS invalidation in asp.net2.0-practical skills

Source: Internet
Author: User

1,css file path is incorrect
This problem is a fundamental issue in web development, typically with a relative path, or a style file written in a master page that can occur when the content page is not in the same level as the master page. At this point you have to understand the web of relative path rules, if you do not know, you can use the absolute path of the writing to try to know whether the path of the problem.

2,CSS Rule spelling Error
This question who can not help you, can only learn the relevant knowledge of CSS.

3, File coding problem
Sometimes, CSS styles in the ASPX file is valid, but placed in a separate file is not valid, such a problem if not the path problem, it is a coding problem, you can open the CSS file Notepad, and then save as ANSI format or UTF-8 format.

4, Permissions issues
A common occurrence of this situation is that the style is invalid before logging in and valid after login, which is a typical permission problem. This problem occurs because Web.config configures all files that do not allow anonymous access, and the workaround is to configure a style file to allow anonymous access for the <location> tag. For example:

Copy Code code as follows:

<configuration>
<location path= "Allow anonymous access to folder names or file Paths" >
<system.web>
<authorization>
<allow users= "?" />
</authorization>
</system.web>
</location>
</configuration>

5, click the button style invalidation
The most typical reason for this is that there are statements like Response.Write in the button event, because ASP.net 2.0 defaults to the http://www.w3.org/TR/xhtml1/DTD/ XHTML1-TRANSITIONAL.DTD document type definition, it requires the <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "There is no output in front of >. The solution to this problem is to use the ClientScriptManager output or to use the literal control to output the content.

6, inside the ASP.net 1.x functioning style to ASP.net 2.0 inside expiration
This problem is generally still caused by XHTML1, because HTTP://WWW.W3.ORG/TR/XHTML1/DTD/XHTML1-TRANSITIONAL.DTD style rules and previous differences, such as the addition of units, such as width:200; Now to write width:200px, the solution to this problem is to explicitly add units.

7, the script set the style is not valid
Due to XHTML1. DTDs require units, so when you set the value of an object style, you still need to add a unit, such as Obj.style.width = "200px." The following code in Firefox is not valid (don't complain about Firefox trouble)

Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<script type= "Text/javascript" >
<! [cdata[
function SetHeight ()
{
document.getElementById ("x"). style.height= "200"
}
]]>
</script>

<body>
<div id= "x" style= "background: #DDD; height:auto;" > Testing </div>
<input type= "button" value= "setting" onclick= "setheight ()"/>
</body>

Although the above in IE normal, but in Firefox there will be problems. The correct wording is

Copy Code code as follows:

document.getElementById ("x"). style.height= "200px"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.