开发者

Why is my CSS intemittently failing to take effect?

开发者 https://www.devze.com 2023-01-08 02:25 出处:网络
I have a problem I see every so often - I create a CSS file, link it in a webpage, but then it sometimes takes effect and sometimes doesn\'t. I\'ve set up a very simple example which has the problem.

I have a problem I see every so often - I create a CSS file, link it in a webpage, but then it sometimes takes effect and sometimes doesn't. I've set up a very simple example which has the problem.

This page is at http://localhost:8080/myapp/index.faces (It's generated from JSF, but I don't think that's relevant - I've copied the HTML source here)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti开发者_JS百科onal.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>My Page</title>
    <link href="styles.css" rel="stylesheet" type="text/css"/>
  </head>
  <body>
    blah blah...
  </body>
</html>

I can view the styles.css file no problem from the browser address bar, at http://localhost:8080/myapp/styles.css

It was working, then after redeploying the app it stopped. Really annoying. I'm using IE7 - can anyone offer any enlightenment on this behaviour?


As soon as I ask the question, I work out what's going on!

In this case - something odd has happened, rolling back my JSP file to a previous version - losing the styling attributes. So everything was working fine, but the CSS classes weren't there in the HTML.

Thanks for the help, anyway!

0

精彩评论

暂无评论...
验证码 换一张
取 消