首页 > 解决方案 > 链接外部样式表

问题描述

我的所有东西都在样式标签中工作,但是一旦我将样式标签中的内容剪切并粘贴到 .css 并链接它,样式就停止工作了。我唯一能想到的是文件路径错误。我的 html 文件和样式表在同一个目录中。

这是我链接它的方式(这不起作用):

<head>

    <title>Video Game Reviews</title>
    
    <link rel="stylesheet" type="text/css" href="./mystyle.css">    
    
</head>

这确实有效:

<head>

    <style>

          body { 
                background-color: rgb(255, 0, 255); /* this is the pink color */
                color: black;  /* color of font */
                font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; /* no tail font is more readable for small font */
                font-size:16px;
         }
   
    </style>

</head>

标签: htmlcss

解决方案


看到您的 CSS 文件中没有 HTML 标记。


推荐阅读