HTML / CSS没有链接?

时间:2018-05-15 14:59:07

标签: html css

尝试使用左侧列设置一个简单的html站点但是我无法使用CSS连接HTML文件,即使CSS写入文件中也是如此。这里出了什么问题?

<!DOCTYPE html>
<html>

<head>
  <title>My Portfolio Site</title>
  <meta name="description" content="A site built to showcase what I learned in the full stack Udacity course.">
  <style>
    colors {
      background-color: blue;
      display: inline-block;
      width: 30%;
    }
    
    top_header {
      background-color: yellow;
      display: inline-block;
      width: 70%;
    }
  </style>
</head>

<body>
  <aside class=“colors”>
    <section class=“gray”>gray</section>
    <section class=“black”>black</section>
    <section class=“blue”>blue</section>
  </aside>
  <section class=“top_header”>
    <section id=“logo”>logo</section>
  </section>
</body>

</html>

2 个答案:

答案 0 :(得分:1)

两个问题

.class {}以点

开头

并使用普通的双引号,而不是MS-Word

请使用记事本或文本板或崇高文本而不是文字处理器

.colors {
  background-color: CornflowerBlue ;
  display: inline-block;
  width: 30%;
}

.top_header {
  background-color: yellow;
  display: inline-block;
  width: 70%;
}
.gray { color:#ddd }
.blue { color:blue }
.black { color:black }
<aside class="colors">
  <section class="gray">gray</section>
  <section class="black">black</section>
  <section class="blue">blue</section>
</aside>
<section class="top_header">
  <section id="logo">logo</section>
</section>

答案 1 :(得分:0)

要指明课程,您必须以点开头

<style>
  .colors {
    background-color: blue;
    display: inline-block;
    width: 30%;
  }
  .top_header {
    background-color: yellow;
    display: inline-block;
    width: 70%;
  }
</style>