我正在尝试将选项卡放在我的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>
<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>
有一些问题:
- ID不能包含空格。更改"登录"为"登录"one_answers"注册"为"注册"。
- 有几个嵌套的
<form>
标签。表格不能包含表格。我已经删除了它们。 - 有一个错误的
</h2>
标签。我删除了它。 -
<form>
包含<div>
后关闭。我切换了关闭标签。 - 关闭
</p>
标签似乎是作为关闭</div>
标签的目的。
我认为这可能更接近您的目标:
<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>
<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>
您可能会从使用HTML验证器中受益。
这似乎以相当清晰的方式显示错误。