我的Html文件没有显示任何样式

时间:2013-04-09 04:41:53

标签: css stylesheet

我正在创建一个简单的静态HTML网站,但我意识到,由于某种原因,它没有显示任何CSS样式。起初我虽然这是一个链接问题,但后来我意识到样式属性即使在HTML文件中也不起作用。这是一个简单的例子:

<!DOCTYPE html>
<head>
    <link rel="stylesheet" type="text/css" href="../style.css">
    <meta charset="utf-8" />
</head>

<body>
    <p style="text-decoration: underlined;">This is my body green</p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
    <p>This is my body </p>
</body>

样式表:

body {
    background: #c9c9c9;

}

有什么建议吗?

2 个答案:

答案 0 :(得分:3)

您有<p style="text-decoration: underlined;">This is my body green</p>

您需要<p style="text-decoration: underline;">This is my body green</p>

underline而非underlined

在您按照Tieson T.的建议并使用正确的HTML标记后,这将解决您的内联CSS问题。

答案 1 :(得分:2)

你试试这个

 <!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css"> --->MAKE SURE OF DESIRED    PATH
<meta charset="utf-8" />
</head>
<body>
<p style="text-decoration: underline;">This is my body green</p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
<p>This is my body </p>
</body>
</html> ---->Close HTML TAG