gpt4 book ai didi

html - 调整浏览器大小时如何在我的网页上添加滚动条?

转载 作者:太空宇宙 更新时间:2023-11-04 01:59:58 24 4
gpt4 key购买 nike

为什么如果我调整浏览器的大小,却无法上下滚动查看页面的全部内容?

enter image description here

这是我的 HTML:

<!DOCTYPE html>
<html>
<head><title>Faceboo Practice</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<div id="faceboo_logo" class="header">Faceboo
</div>
<div id="form1" class="header">Email or Phone?<br>
<input type="email" placeholder="email"/>
</div>
<div id="form2" class="header">Password<br>
<input type="Password" placeholder="Password"/><br>
Forgot password?
</div>
</div>
<input type="submit" class="submit1" value="login"/>
<div class="body1">
<div id="left_content1" class="body1">Faceboo helps you connect and share with the people in universities</div>
<div id="left_content2" class="body1">Create Account</div>
<div id="left_content3" class="body1">It’s free and always will be.</div>
<div id="form3" class="body1">
<input placeholder="First Name" type="text" id="namebox" />
<input placeholder="Last Name" type="text" id="namebox" /><br>
<input placeholder="Mobile Number or Email" type="text" id="emailbox" /><br>
<input placeholder="Re-Enter Mobile Number or Email" type="text" id="namebox" /><br>
<input placeholder="New password" type="text" id="namebox" /><br>
Birthday<br>
<input type="date" id="namebox"/><br>
<input type="radio" id="sex" value="male"/>male
<input type="radio" id="sex" value="male"/>female<br>
By clicking Create Account, you agree to our Terms and that you have read our Data Policy, including our Cookie Use. You may receive SMS Notifications from Faceboo and can opt out at any time.<br><br>
<input type="button" class="button2" value="SUBMIT">
<hr>Create a Page for a celebrity, band or business.
</div>
</div>
<div class="footer">
<p>English(US) Tagalog Bisaya Español 日本語 한국어 中文(简体) العربية Português(Brasil) Français(France) Deutsch</p><br>
<hr>
</div>
</body>

</html>

这是我的 CSS:

body{
background-color: #fff;
margin: 0;
padding: 0;
}
.header{
height: 100px;
width: 100%;
background-color: #3363ff;
position: fixed;
}
.header #faceboo_logo{
font-size: 50px;
color: white;
top: 25px;
left: 25px;
height: 50px;
width: 200px;
}
.header #form1{
top: 25px;
left: 900px;
height: 50px;
width: 175px;
}
.header #form2{
top:25px;
left: 1080px;
height: 50px;
width: 175px;
}
.submit1{
position: fixed;
height: 50px
width :50px;
left: 1260px;
top: 45px;
}
.body1{
top:100px;
background: #e9ebee;
width: 100%;
height: 500px;
position: fixed;
}
#left_content1{
font-size: 50px;
left: 130px;
width: 500px;
top: 120px;
height: 200px;
}

#left_content2{
font-size: 50px;
left: 850px;
width: 320px;
top: 120px;
height: 50px;
}
#left_content3{
font-size: 20px;
left: 850px;
top: 170px;
height: 20px;
width: 225px;
}

#form3{
width: 350px;
height: 22px;
left: 850px;
position: absolute;
}
.footer{
top:600px;
width: 900px;
position: fixed;
align-items: center;
height: 200px;
left: 20%;
word-spacing: 10px;
}

顺便说一句。这只是为了练习我的 html 和 css 技能,我的选项用完了

最佳答案

发生这种情况是因为 body1header 类上的 position:fixed 属性,如果一切都是固定的,那么什么将是可滚动的。

.header{
height: 100px;
width: 100%;
background-color: #3363ff;
/*position: fixed;*/
}
.body1{
/*top:100px;*/
background: #e9ebee;
width: 100%;
height: 500px;
/*position: fixed;*/
}

更新你的 CSS。

关于html - 调整浏览器大小时如何在我的网页上添加滚动条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41936061/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com