我写错了css,但我不知道出了什么问题

时间:2018-02-15 23:24:01

标签: html css

我正在做一个网站,我似乎无法使我的CSS申请,一切都显示为旁边的明文。我一直在寻找一个多小时,我无法弄清楚我做错了什么。

    <!DOCTYPE html>
<html>
<head>
<title>SOLAR RECORDS</title>
<meta name="viewport" content="width=device-width.intial-scale=1.0"
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Jura" rel='stylesheet'>
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">

<style type="text/css">

body {
background-color: #0c0c0c;
padding: 0;
margin: 0;
}

.sidenav {
height: 100%
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111
overflow-x: hidden;
padding-top: 60px;
transition: 0.5s;

here's the full text

1 个答案:

答案 0 :(得分:0)

您错过了}中的结束.sidenav。因此,之后的所有样式都不会被应用。正确添加它会应用其后面的样式。

除此之外,您还错过了>中的结束<meta name>,这意味着您的Google字体也未被应用。

最后,你的颜色都有五个字符。您需要使用3个字母(简写)或6个字符作为完整的十六进制值。

您可以使用 W3 Markup Validation Service.

验证代码,从而避免这些错误

这是一个有效的例子:

&#13;
&#13;
<!DOCTYPE html>
<html>

<head>
  <title>SOLAR RECORDS</title>
  <meta name="viewport" content="width=device-width.intial-scale=1.0">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Jura" rel='stylesheet'>
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">

  <style type="text/css">
    body {
      background-color: #0c0c0c;
      padding: 0;
      margin: 0;
    }
    
    .sidenav {
      height: 100% width: 0;
      position: fixed;
      z-index: 1;
      top: 0;
      left: 0;
      background-color: #111 overflow-x: hidden;
      padding-top: 60px;
      transition: 0.5s;
    }
    
    .sidenav a {
      padding: 8px 8px 8px 32px;
      text-decoration: none;
      font-size: 25px;
      font-family: 'Opens Sans Condensed', sans-serif;
      color: #ffffff;
      display: block;
      transition: 0.3s;
    }
    
    .sidenav a:hover {
      color: #cccccc;
    }
    
    .sidenav .closebtn {
      position: absolute;
      top: 0;
      right: 25px;
      font-size: 36px;
      margin-left: 50px;
    }
    
    img.center {
      display: block;
      margin: 0;
    }
    
    h1 {
      font-size: 25px;
      font-family: 'Jura', sans-serif;
      color: #ffffff;
      text-align: center;
    }
  </style>

</head>

<body>

  <h1>SOLAR RECORDS&trade;</h1>
  <div style="text align: center"><img src="the.png" alt="Records"></div>

  <div id="mySidenav" class="sidenav">
    <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
    <a href="/">HOME</a>
    <a href="releases.html">RELEASES</a>
    <a href="artists.html">ARTISTS</a>
    <a href="events.html">EVENTS</a>
    <a href="mixes.html">MIXES</a>
    <a href="news.html">NEWS</a>
    <a href="label.html">LABEL</a>
    <a href="contact.html">CONTACT</a>
  </div>

  <span onclick="openNav()">OPEN</span>

</body>

</html>
&#13;
&#13;
&#13;