代码现在有效 我能够使第一页正常工作并将其链接到第二页,它使用相同的 CSS 和非常相似的 HTML,所以我不明白为什么按钮根本不显示。
注意:当我删除 .html 文件中的 .css 链接时,所有按钮和输入都出现了! 我已经修复了 .comm 中的“隐藏”并添加了:
#register{
visibility: visible;
}
* {
padding: 0;
margin: 0;
/*box-size:border-box;*/
}
body {
background: rgba(255, 84, 151, 0.40);
}
#container {
width: 300px;
margin: 0 auto;
margin-top: 150px;
}
.tabs {
display: table-cell;
width: 30%;
background-color: rgba(11, 177, 224, 0.82);
padding: 10px;
float: left;
text-align: center;
vertical-align: middle;
border: 2px solid #ffffff;
border-bottom: 0px;
position: relative;
font-size: 1.3em;
color: #ffffff;
}
.tabs:hover,
p {
cursor: pointer;
}
#lt {
background-color: rgb(12, 132, 189);
}
#cont {
width: 95%;
height: 380px;
background-color: rgba(11, 177, 224, 0.82);
border: 2px solid #ffffff;
}
input {
display: block;
width: 250px;
margin: 10px 13px;
padding: 10px;
font-size: 1.3em;
color: rgba(11, 177, 224, 0.82);
outline: 2px solid #ffffff;
}
input[type="submit"] {
width: 272px;
color: #6e6e6e;
}
#clear {
clear: both;
}
.comm {
position: absolute;
visibility: hidden;
}
#login {
visibility: visible;
}
h3 {
display: table-cell;
vertical-align: middle;
padding: 10px 15px;
font-size: 1.5em;
color: #ffffff;
}
#forgot h3 {
display: block;
margin-top: 30px;
text-align: center;
}
#forgot div {
margin-top: 30px;
}
p {
padding: 10px 15px;
font-size: 1.3em;
color: #ffffff;
}
<header>
<h2>Billy Bronco's Grading Calculator</h2>
</header>
<div id="container">
<div id="tabs">
<p id="rt" class="tabs" onclick="regTabFun()">Register</p>
<link rel="stylesheet" href="Login.css">
<div id="clear"></div>
</div>
<div id="cont">
<div id="register" class="comm">
<h3>Register</h3>
<input id="re" type="email" placeholder="Email" required/>
<input id="rp" type="password" placeholder="Password" required/>
<input id="rrp" type="password" placeholder="Re write Password" required/>
<input type="button" class="button" id="enterR" value="Register">
<input type="button" class="button" id="enter" value="Login">
<input type="button" class="button" id="forgotPass" value="Forgot Password?">
</div>
</div>
</div>
<script src="RegisterTs.js"></script>
谢谢!
答案 0 :(得分:1)
您使用 .comm
类的可见性规则隐藏了所有内容。删除那个。
* {
padding: 0;
margin: 0;
/*box-size:border-box;*/
}
body {
background: rgba(255, 84, 151, 0.40);
}
#container {
width: 300px;
margin: 0 auto;
margin-top: 150px;
}
.tabs {
display: table-cell;
width: 30%;
background-color: rgba(11, 177, 224, 0.82);
padding: 10px;
float: left;
text-align: center;
vertical-align: middle;
border: 2px solid #ffffff;
border-bottom: 0px;
position: relative;
font-size: 1.3em;
color: #ffffff;
}
.tabs:hover,
p {
cursor: pointer;
}
#lt {
background-color: rgb(12, 132, 189);
}
#cont {
width: 95%;
height: 380px;
background-color: rgba(11, 177, 224, 0.82);
border: 2px solid #ffffff;
}
input {
display: block;
width: 250px;
margin: 10px 13px;
padding: 10px;
font-size: 1.3em;
color: rgba(11, 177, 224, 0.82);
outline: 2px solid #ffffff;
}
input[type="submit"] {
width: 272px;
color: #6e6e6e;
}
#clear {
clear: both;
}
.comm {
position: absolute;
/* visibility: hidden; <----------------------------HERE */
}
#login {
visibility: visible;
}
h3 {
display: table-cell;
vertical-align: middle;
padding: 10px 15px;
font-size: 1.5em;
color: #ffffff;
}
#forgot h3 {
display: block;
margin-top: 30px;
text-align: center;
}
#forgot div {
margin-top: 30px;
}
p {
padding: 10px 15px;
font-size: 1.3em;
color: #ffffff;
}
<header>
<h2>Billy Bronco's Grading Calculator</h2>
</header>
<div id="container">
<div id="tabs">
<p id="rt" class="tabs" onclick="regTabFun()">Register</p>
<link rel="stylesheet" href="Login.css">
<div id="clear"></div>
</div>
<div id="cont">
<div id="register" class="comm">
<h3>Register</h3>
<input id="re" type="email" placeholder="Email" required/>
<input id="rp" type="password" placeholder="Password" required/>
<input id="rrp" type="password" placeholder="Re write Password" required/>
<input type="button" class="button" id="enterR" value="Register">
<input type="button" class="button" id="enter" value="Login">
<input type="button" class="button" id="forgotPass" value="Forgot Password?">
</div>
</div>
</div>
<script src="RegisterTs.js"></script>