@media屏幕?不能向下移动箱子?

时间:2016-02-07 15:05:10

标签: jquery html css

好吧两个问题......当屏幕变小时我怎么拿掉滚动条?为什么我不能把盒子移开?正如您从底部的代码中看到的那样滚动条仍然没有任何理由,即使使用填充也不会移动按钮!我很感激您的建议。

<!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>

1 个答案:

答案 0 :(得分:0)

滚动条没有消失,因为&#39; p&#39; element的位置设置为绝对值。和左边的一样。价值300px。

这意味着该元素的宽度为600px,左侧值为300px,即使窗口尺寸较小,也可以使其宽度达到900px。