如何制作游戏的专业标签

时间:2019-05-21 19:35:36

标签: javascript html css

我完全按照这个youtube视频观看了如何制作一些专业标签 https://www.youtube.com/watch?v=FvzZjg-uP2k&t=241s

但是我的代码却没有以相同的方式出现。我想像他们一样,这样我就可以滚动浏览不同的标签,并为每个标签制作一个单独的html文件

我已经尝试过观看视频(css中的新功能),我认为我的格式正确

这是我的css / html代码:

Css代码:

body {
    margin: auto;
    background: #efefef;
    font-family: arial;
}
.nav_bar {
    margin: auto;
    border-bottom: 1px solid #000000;
    width: 860px;
   padding: 0px 20px 0px 20px;
    height: 64px
    margin-top: 30px;
}
.nav_bar ul {
    padding: 0;
    list-style: none;
}
.nav_bar ul li {
    float: left;
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
}
.nav_bar ul li a {
    text-decoration:none;
    color: #000000;
    background: #6db1e4;
    border: 1px solid #000000;
    border-bottom: none;
    padding: 23px 20px 22px 20px;
    -webkit-border-top-right-radius: 10px;
    -webkit-border-top-left-radius: 10px;
    -moz-border-radius-topleft: 10px;
    -moz-border-radius-topright: 10px;
    width: 75px;
    display: block;
    text-align: center;
}
.nav_bar ul li a:hover{
    text-decoration: none;
    color: #000000;
    background: #96e0e9;
    -moz-transition: background-color 200ms ease-in;
    -webkit-transition: background-color 200ms ease-in;
    -ms-transition: background-color 200ms ease-in;
    -o-transition: background-color 200ms ease-in;
    transition: background-color 200ms ease-in;
}
.nav_bar ul li a#onlink {
    background: #ffffff;
    color: #000000;
    border-bottom: 1px solid #ffffff;
}
.nav_bar ul li a#onlink:hover;{
    background: #ffffff;
    color: #000000;
}
.main_container{
    margin auto;
    width: 860px;
    padding: 20px;
    border: 1px solid #000000;
    min-height: 400px;
    border-top: none;
    background: #ffffff;
}
.main_container p {
    font-size: 14px;
    margin: 0;
    padding: 0;
}

我的html代码:

<!Doctype html>
<html>
<head>
<title> Basic Clicker</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body
      <div class="nav_bar">
        <ul>
            <li><a href="index.html">Home</a></li>
            <li><a href="skilltree.html">SkillTree</a></li>
            <li><a href="equipment.html">Equipment</a></li>
            <li><a href="pets.html">Pets</a></li>
            <li><a href="skills.html">Skills</a></li>
            <li><a href="quests.html">Quests</a></li>
        </ul>
    </div>
    <div class="main_container">
        <p> This is the home page.</p>
    </div>
</body>
</html>

我希望html链接看起来像他在视频结尾处显示的一样,但实际输出有些偏离,无法滚动浏览页面http://prntscr.com/nrkf6v,这是我的输出不正确

1 个答案:

答案 0 :(得分:0)

您没有正确格式化它。

您有5或6个CSS错误,其中有一个HTML大错误。 (<body标签未关闭)。根据经验,在网络中,每个字符都很重要。有一些例外,但这正是它们:例外。

规则是:“每个错误都会破坏某些东西”。
这是正确的输出。

您要用来检查代码的工具称为验证器。 (HTML验证器,CSS验证器等)。或者,您可以使用IDE(一种智能编辑器,该智能编辑器会在键入时理解并建议代码,并在考虑当前Web标准的情况下让您知道何时认为自己犯了错误)。

body {
  margin: auto;
  background: #efefef;
  font-family: arial;
}

.nav_bar {
  margin: auto;
  border-bottom: 1px solid #000000;
  width: 860px;
  padding: 0 20px 0 20px;
  height: 64px;
  margin-top: 30px;
}

.nav_bar ul {
  padding: 0;
  list-style: none;
}

.nav_bar ul li {
  float: left;
  font-size: 16px;
  font-weight: bold;
  margin-right: 10px;
}

.nav_bar ul li a {
  text-decoration: none;
  color: #000000;
  background: #6db1e4;
  border: 1px solid #000000;
  border-bottom: none;
  padding: 23px 20px 22px 20px;
  -webkit-border-top-right-radius: 10px;
  -webkit-border-top-left-radius: 10px;
  -moz-border-radius-topleft: 10px;
  -moz-border-radius-topright: 10px;
  width: 75px;
  display: block;
  text-align: center;
}

.nav_bar ul li a:hover {
  text-decoration: none;
  color: #000000;
  background: #96e0e9;
  -moz-transition: background-color 200ms ease-in;
  -webkit-transition: background-color 200ms ease-in;
  -ms-transition: background-color 200ms ease-in;
  -o-transition: background-color 200ms ease-in;
  transition: background-color 200ms ease-in;
}

.nav_bar ul li a#onlink {
  background: #ffffff;
  color: #000000;
  border-bottom: 1px solid #ffffff;
}

.nav_bar ul li a#onlink:hover {
  background: #ffffff;
  color: #000000;
}

.main_container {
  margin: auto;
  width: 860px;
  padding: 20px;
  border: 1px solid #000000;
  min-height: 400px;
  border-top: none;
  background: #ffffff;
}

.main_container p {
  font-size: 14px;
  margin: 0;
  padding: 0;
}
<!Doctype html>
<html>

<head>
  <title> Basic Clicker</title>
  <link rel="stylesheet" href="css/style.css" />
</head>

<body>
  <div class="nav_bar">
    <ul>
      <li><a href="index.html">Home</a></li>
      <li><a href="skilltree.html">SkillTree</a></li>
      <li><a href="equipment.html">Equipment</a></li>
      <li><a href="pets.html">Pets</a></li>
      <li><a href="skills.html">Skills</a></li>
      <li><a href="quests.html">Quests</a></li>
    </ul>
  </div>
  <div class="main_container">
    <p> This is the home page.</p>
  </div>
</body>

</html>