HTML我的第二个标签不会改变?

时间:2017-09-08 17:29:25

标签: html css

我正在尝试在我的html网站中添加标签。登录选项卡是我想要的方式。它只是说电子邮件密码登录!但是“注册”选项卡不会更改为我为代码添加的内容。我的代码看起来不错吗?

<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
</script>
</head>
<body>

<div class="container">

<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#log in">Log In</a></li>
<li><a data-toggle="tab" href="#menu1">Sign Up</a></li>
</ul>

<div class="tab-content">
<div id="log in" class="tab-pane fade in active">
<br>
<form>

电子邮件:
    

  密码:
         

<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

<button type="button">Log In!</button> <br> <br>

</div>

<div id="sign up" class="tab-pane fade">
  <form action="/action_page.php">

  <form action="/action_page.php">

用户名:
     

<form action="/action_page.php">

电子邮件:
       

<form>  Password:<br>
<input type="password" name="psw">

<br>

<p>By clicking Sign Up, you agree to our Terms and Privacy Policy</p> 

<button type="button">Sign Up!</button> </h2> </div> 

</form>
</p>

</div>
</body>
</html>

1 个答案:

答案 0 :(得分:3)

有一些问题:

  1. ID cannot contain spaces。更改&#34;登录&#34;到&#34;登录&#34;并且&#34;注册&#34;到&#34;注册&#34;。
  2. 有几个嵌套的<form>标记。 Forms cannot contain forms。我已将它们删除了。
  3. 存在错误的</h2>标记。我删除了它。
  4. <form>关闭<div>之后关闭。我切换了结束标签。
  5. 结束</p>代码似乎是一个结束</div>代码。
  6. 我认为这可能更接近你的目标:

    &#13;
    &#13;
    <html lang="en">
    
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
      </script>
    </head>
    
    <body>
    
      <div class="container">
    
        <ul class="nav nav-tabs">
          <li class="active"><a data-toggle="tab" href="#login">Log In</a></li>
          <li><a data-toggle="tab" href="#signup">Sign Up</a></li>
        </ul>
    
        <div class="tab-content">
    
          <div id="login" class="tab-pane fade in active">
            <form>
              E-mail:<br>
              <input type="text" name="e-mail"><br><br>
              Password:<br>
              <input type="password" name="psw"><br><br>
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              <button type="button">Log In!</button><br><br>
            </form>
          </div>
    
          <div id="signup" class="tab-pane fade">
            <form action="/action_page.php">
              Username:<br>
              <input type="text" name="Username"><br><br>
              E-mail:<br>
              <input type="email" name="e-mail"><br><br>
              Password:<br>
              <input type="password" name="psw"><br>
              <p>By clicking Sign Up, you agree to our Terms and Privacy Policy</p>
              <button type="button">Sign Up!</button>
            </form>
          </div>
    
        </div>
      </div>  
    </body>
    </html>
    &#13;
    &#13;
    &#13;

    您可能会因使用HTML验证器而受益 This one似乎以相当清晰的方式显示错误。

相关问题