首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >CSS未应用于页面

CSS未应用于页面
EN

Stack Overflow用户
提问于 2013-07-02 02:57:47
回答 2查看 445关注 0票数 0

我目前有一个相当简单的页面,由于某些原因,maincss.css没有被应用,它只是设置图像的背景。我知道它是有效的,因为在我为jquery样式添加另一个css文件之前,它是有效的。这是错的吗?

代码语言:javascript
运行
复制
<html xmlns=\ "http://www.w3.org/1999/xhtml\" xml:lang=\"en\">
<head>
  <META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
  <title>Welcome to Jetty-9</title>
  <link href="css/jquery-ui-1.10.3.custom.css" rel="stylesheet">
  <link href="css/maincss.css" rel="stylesheet">
  <script type='text/javascript' src='js/jquery.js'></script>
  <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  <script type="text/javascript">
    $(function() {
      $( "#dialog" ).dialog({
      width: 400,
      buttons: [
        {
          text: "Ok",
          click: function() {
            $( this ).dialog( "close" );
          }
        },
        {
          text: "Cancel",
          click: function() {
            $( this ).dialog( "close" );
          }
        }
      ]
    });
    });
  </script>
</head>
<body>

  <div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
  </div>

</body>
</html>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-07-02 03:16:35

看起来你可能会遇到问题,因为:

CSS文件中的

  1. 您没有正确指定图像路径。(您应该提供CSS文件的相对路径,而不是html的相对路径)
  2. 在新的CSS文件中,body{}标记被覆盖为空。

对于分辨率:尝试通过将background-color配置为某种颜色来检查CSS并对其进行测试。因此,通过这种方式,您可以确保CSS工作正常,同时也可以尝试其他选项。

票数 5
EN

Stack Overflow用户

发布于 2013-07-02 03:03:12

尝尝这个

代码语言:javascript
运行
复制
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Script-Type" CONTENT="text/javascript">
  <title>Welcome to Jetty-9</title>
  <link type="text/css" href="css/jquery-ui-1.10.3.custom.css" rel="stylesheet" />
  <link type="text/css" href="css/maincss.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery.js"></script>
  <script type="text/javascript"  src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  <script type="text/javascript">
    $(function() {
      $("#dialog").dialog({
      width: 400,
      buttons: [
        {
          text: "Ok",
          click: function() {
            $( this ).dialog( "close" );
          }
        },
        {
          text: "Cancel",
          click: function() {
            $( this ).dialog( "close" );
          }
        }
      ]
    });
    });
  </script>
</head>
<body>

  <div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
  </div>

</body>
</html>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17411685

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档