外部CSS样式表没有链接

时间:2016-04-06 14:15:58

标签: html css xhtml external stylesheet

首先,我想补充一点,在此之前我已查看了很多帖子,没有一个符合我的确切情况。

问题:

  1. “Lounge.html”是下面显示的'index'html文件
  2. “test.css”是我尝试链接到的外部.css文件,也显示在下面
  3. “Lounge.html”和“test.css”都在同一个文件夹中;根文件夹
  4. 所有“img”和“a”元素 处于正常工作状态
  5. 当我在Microsoft Edge或Internet Explorer中运行“Lounge.html”时,该样式不会应用于我的页面。
  6. 我希望得到一些帮助,让这个外部链接正常工作。

    此致

    AA

    h1, h2 {
    font-family: sans-serif;
    color: gray;
    }
    h1 {
    border-bottom: 1px solid black;
    }
    p {
    font-family: sans-serif;
    color: maroon;
    }
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
        <title>Head First Lounge</title>
    
    <link type="text/css" rel="stylesheet" href="test.css" />
    
      </head>
      <body>
        <h1>Welcome to the New and Improved Head First Lounge</h1>
        <p><img src="images/drinks.gif" alt="Drinks" /></p>
        <p>
          Join us any evening for refreshing 
          <a href="beverages/elixir.html">elixirs</a>, 
          conversation and maybe a game or two of 
          <em>Dance Dance Revolution</em>.  
          Wireless access is always provided;  
          BYOWS (Bring Your Own Web Server).
        </p>
        <h2>Directions</h2>
        <p>
          You'll find us right in the center 
          of downtown Webville.  If you need help finding
          us, check out our 
          <a href="about/directions.html">detailed directions</a>. 
          Come join us!
        </p>
      </body>
    </html>

3 个答案:

答案 0 :(得分:0)

尝试更新浏览器。

对于IE:如果仍然出现错误,请插入

Button save_control_button = (Button) findViewById(R.id.save_control_button);
    save_control_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

//some code

            Intent passIntent = new Intent(getApplicationContext(),Manu_1xsd.class);
            startActivity(passIntent);

        }
    });

<meta http-equiv="X-UA-Compatible" content="IE=edge"> 部分,然后尝试加载它。

希望这会有所帮助!

答案 1 :(得分:0)

这可能是浏览器缓存的问题。 清除缓存并再次检查。清除缓存的简单方法是在添加后添加一些radom字符串?到网址。实施例

http://example.com/test.html?somerandomtext

答案 2 :(得分:0)

要解决此问题,如果您想将“修复”称为“修复”,我只需将这两个文件(html,css)上传到网络托管服务器即可。 “index”html文件立即受到外部样式表的影响,这与我对本地方法的尝试不同。