CSS样式不起作用

时间:2014-12-16 23:13:02

标签: html css

我正在尝试在HTMl文档中使用CSS,但它似乎不起作用我尝试在外部使用它,但它也没有工作。我不知道它出了什么问题它应该在页面顶部创建一个960px宽和200像素高的绿色框,但它没有做任何事情

<!DOCTYPE html>
<html>
<head>
    <title>Xbox UK Home</title>
    <meta name=“description” content=“Xbox is a gaming console created by Microsoft”/>
    <meta name=“keywords” content=“Xbox, games, Microsoft, Xbox Live” />
    <meta name=“robots” content=“nofollow” />

<style>
#header {
width: 960px;
background-color:#006400;
height: 200px;
}
</style>


</head>
<body>
    <!—-Main Header—->
    <header id=“header”> </header>

    <!—-Second Header—->
    <section> </section>

    <!—-Main Image—->
    <section> </section>

    <!—-Box One —-!>
    <Section> </Section>

    <!—-Box Two —-!>
    <Section> </Section>

    <!—-Box Three —-!>
    <Section> </Section>

    <!—-Box Four —-!>
    <Section> </Section>

    <!—-Box Five —-!>
    <Section> </Section>

    <Footer></Footer>


</body>

4 个答案:

答案 0 :(得分:8)

您有<header id=“header”> </header>

摆脱微软报价

"header"

答案 1 :(得分:0)

这些报价是错误的。使用 ”” 例如:

<header id="header"> </header>

答案 2 :(得分:0)

将HTML更改为:

<!—-Main Header—->
 <header> </header>

header {
width: 960px;
background-color:#006400;
height: 200px;
}

一切都应该有效

答案 3 :(得分:-5)

我相信你的样式标签需要类型attr。 <style type="text/css"> ...我相信您可以使用<script>而不是类型,但需要使用类型的样式。