>好的两个问题...当屏幕变小时如何取下滚动条,为什么我不能向下移动框?从底部的代码中可以看出,滚动条仍然无缘无故地存在,即使有填充,按钮也不会移动!我很感激你能提出的任何建议。
<!DOCTYPE html>
<html>
<link rel="shortcut icon" href="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Metro-M.svg/2000px-Metro-M.svg.png">
<head>
<style>
body {
background: URL("https://lh3.googleusercontent.com/-lYQ3vQHE3Mo/VrVKGwg8pqI/AAAAAAAADMQ/QKjs5ALViKo/w530-d-h253-p-rw/desk%2Bbackground.png") white no-repeat center top;
background-size: 100%;
background-color: white;
margin: 0;
padding: 0;
}
h2 {
Font-family: Arial;
top: 650px;
left: 10px;
position: absolute;
color: #525252;
font-size: 2vw;
letter-spacing: 1px;
}
h1 {
position: absolute;
top: 21%;
left: 36%;
color: white;
font-family: Arial;
font-size: 4.6vw;
letter-spacing: 1px;
}
p {
position: absolute;
width: 600px;
top: 800px;
left: 300px;
height: 25px;
font-family: Gill Sans, sans-serif;
color:#696969;
font-size: 17px;
}
ul {
word-spacing: .2em;
letter-spacing: .2em;
}
ul li {
font-family: Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
top: 43%;
display: inline-block;
margin-top: 250px;
margin-left: 115px;
letter-spacing: 1px;
word-spacing: normal;
background-color: rgba(5, 4, 2, 0.1);
border: 2px solid white;
color: white;
text-align: center;
text-decoration: none;
font-size: 90%;
width: 150px;
height: 40px;
}
ul li:link,
ul li:visited {
font-family: Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
display: inline-block;
margin-top: 250px;
margin-left: 115px;
letter-spacing: 1px;
word-spacing: normal;
background-color: rgba(5, 4, 2, 0.1);
border: 2px solid white;
font-size: 90%;
width: 150px;
height: 40px;
text-decoration: none;
color: white;
}
li {
text-decoration: none;
color: white;
}
ul li:hover,
ul li:active {
background-color: white;
color: black;
text-decoration: none;
}
ul li a:hover, ul li a:active {
background-color: white;
color: black;
}
ul li a {
display: inline-block;
height: 100%;
width: 100%;
color: white;
text-decoration: none;
}
hr {
margin-right: 150px;
margin-left: 150px;
top: 700px;
}
@media screen and (max-width: 700px) {
.wrapper {
padding-top: 40%;
}
ul li {
margin: 10px;
}
h1{
position:absolute;
top: 70px;
left: 180px;
font-size
}
}
.wrapper {
padding-top: 0%;
}
</style>
<link rel="stylesheet" type="text/css" href="about.css">
<title>morgan</title>
</head>
<body>
<center><h1>WHO AM I?</h1></center>
<h2>Some Fun Facts</h2>
<p>I made this website from scratch when I was 14, I have a twin brother whose name is Pierson McNeal White, I have a older brother and sister who are aslo twins, I used to have 2 pet rats named Hermes and Cleo after the greek gods, and I watch the super bowl for the ads.</p>
<div class="wrapper">
<ul>
<li><a href="www.youtube.com" class="life" ><strong>MY LIFE</strong></a></li>
<li><a href="www.youtube.com" class="prot"><strong>PORTFOLIO</strong></a></li>
<li><a href="www.youtube.com" class="resume"><strong>RESUME</strong></a></li>
<li><a href="about.html" class="me"><strong>ABOUT ME</strong></a></li>
</ul>
</div>
</body>
</html>
滚动条不会消失,因为"p"元素的位置设置为绝对值。以及 300px 的"左"值。
这意味着元素将保持 600px 的宽度和 300px 的左侧值,即使窗口大小较小,也能有效地使其宽 900px。