HTML网站一旦发布就做了奇怪的优化?

时间:2017-07-28 07:19:00

标签: html css optimization layout

我刚刚在今天早些时候发布了我的网站,我注意到实际启动和运行时有一些不同之处。这就是我编码的样子

enter image description here

这就是我在手机上拉起网站时的样子

enter image description here

当我把它拉到我的电脑上时,甚至出现了一些问题,让我怀疑这些是否是优化问题....如果有人能帮助我保留我的所有方面,我会留下下面的代码网站在一个地方,无论观看设备多么令人惊叹!

@font-face {
  font-family: "My Custom Font";
  src: url(fonts/font.ttf) format("truetype");
}

body {
  background: url(img/bg.png) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  o-background-size: cover;
  background-size: cover;
  font-family: "My Custom Font", Times, serif;
  max-width: 100%;
  overflow-x: hidden;
}

#headerbg {
  height: 450px;
  width: 710px;
  background-color: rgb(28, 28, 28);
  position: relative;
  top: 100px;
  border-radius: 15px;
  opacity: 0.6;
}

.header {
  position: relative;
  bottom: 345px;
  color: white;
  padding-right: 30px;
}

#logo {
  position: relative;
  bottom: 605px;
  right: 210px;
}

#inputbg {
  width: 375px;
  height: 550px;
  background-color: rgb(28, 28, 28);
  position: relative;
  left: 168px;
  bottom: 150px;
  border-radius: 15px;
  opacity: 0.6;
}

.input {
  color: white;
  text-align: center;
  position: relative;
  bottom: 320px;
  left: 170px;
}

#firsttxt {
  position: relative;
  bottom: 900px;
  left: 45px;
  color: white;
}

#lasttxt {
  position: relative;
  bottom: 938px;
  left: 187px;
  color: white;
}

#emailtxt {
  position: relative;
  bottom: 933px;
  left: 103px;
  color: white;
}

#downloadhere {
  position: relative;
  bottom: 1512px;
  left: 169px;
}

#enterbtn {
  width: 135px;
  height: 50px;
  color: rgb(186, 209, 225);
  background-color: rgb(203, 38, 38);
  border-color: rgb(203, 38, 38);
  font-size: 20px;
  position: relative;
  text-align: center;
}

#benefits {
  position: relative;
  bottom: 1900px;
  color: white;
  text-align: center;
}

.pdfdisplay {
  position: relative;
  bottom: 860px;
  left: 175px;
}
<!DOCTYPE html>

<html>

<head>

  <title>P2 Fitness Company</title>
  <link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>
  <center>
    <div id="headerbg"></div>
    <div class="header">
      <h1>FREE PDF WITH 7 TIPS TO BOOST <br>YOUR PROGRESS IN THE GYM</h>
    </div>
    <div id="logo">
      <img src="img/p2fitnesstransparent.png" width="350px" height="150px">
    </div>
    <div id="inputbg"></div>

    <div class="input">
      <form method="get" action="files/7tips.pdf">
        <input type="text" name="first" size="15">
        <input type="text" name="last" size="15"> <br> <br>
        <input type="text" name="email" size="20"> <br> <br>
        <input id="enterbtn" type="submit" value="DOWNLOAD">
      </form>
    </div>

    <div class="pdfdisplay">
      <img src="img/pdfdisplay.png" height="400px" width="400px">
    </div>
    <h5 id="firsttxt">FIRST*</h5>
    <h5 id="lasttxt">LAST*</h5>
    <h5 id="emailtxt">EMAIL*</h5>

    <img src="img/downloadhere.png" id="downloadhere">

  </center>

  <div id="benefits">
    <h2>BENEFITS OF PDF</h2>

    <h3>-Utilize the the time you are<br>already spending in the gym</br>
      -Learn new ways to gain muscle</br>
      -Learn to live a healthier lifestyle</br>
      -Reduce risk of injury</h3>
  </div>

</body>

</html>

1 个答案:

答案 0 :(得分:0)

主要问题是您使用px对维度进行了硬编码。所以页面没有响应。如果你想让它完美地工作,那么你必须让它对不同的视口做出响应 BootStrap是使页面响应的好选择。此外,您可以通过利用vwvhvmin属性来使其响应。
来自w3schools的link也可以帮助你。

相关问题