我正在尝试在我的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>
答案 0 :(得分:3)
有一些问题:
<form>
标记。 Forms cannot contain forms。我已将它们删除了。</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>
&#13;
您可能会因使用HTML验证器而受益 This one似乎以相当清晰的方式显示错误。