Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在css中放置?_Html_Css - Fatal编程技术网

Html 如何在css中放置?

Html 如何在css中放置?,html,css,Html,Css,我想把我的css放到它自己的工作表中 我是怎么做到的?这是我的密码 <style> body{color:red;} </style> 将CSS保存到单独的文件中,如style.CSS,并包含在标记中: 您不会在CSS中包含这些标记。这些标记是仅用于HTML文档的标记。以下是您将要做的: 创建一个CSS文件,例如custom.CSS。在该文件中,您将具有以下内容: body { color: red; } 然后在HTML文档中,添加以下标记以链接到外部样式表:

我想把我的css放到它自己的工作表中

我是怎么做到的?这是我的密码

<style> body{color:red;} </style>

将CSS保存到单独的文件中,如style.CSS,并包含在标记中:

您不会在CSS中包含这些标记。这些标记是仅用于HTML文档的标记。以下是您将要做的:

创建一个CSS文件,例如custom.CSS。在该文件中,您将具有以下内容:

body {
    color: red;
}
然后在HTML文档中,添加以下标记以链接到外部样式表:

<link type="text/css" rel="stylesheet" href="custom.css" />

注意:您可能需要根据您的文件结构调整href值。

您需要创建一个css文件,通过使用如上所示的链接,将其链接到需要css的页面头部,但请确保将其添加到任何jquery链接之上,以加快页面加载时间

添加到标题的链接:

<link rel="styesheet" type="text/css" href="style.css"/>

我希望这会有所帮助。

您不包括或标签。你把这些标签里面的所有东西都放进它自己的带有扩展名的表单中。css然后你把它包含在代码中,在你的标题中包括这一行:快速的谷歌搜索就会找到答案。不要让我们把LMGTFY弄出来……请在发布问题之前做一些更多的研究
<link rel="styesheet" type="text/css" href="style.css"/>
/*this css demo file i will call style.css for demo purposes */

/* div styles by id */
#id
{
    color:#000000;
    float:right;
    border:solid 1px #929292
}

/* div style by class */
.class 
{
    color:#000000;
    float:right;
    border:solid 1px #929292
}

/* class style within a div id to use that style only when an item  
* is within that certain div id
*/
#id .class
{
    color:#000000;
    float:right;
    border:solid 1px #929292
}