边距不能正确停留在网页浏览器的100%

时间:2014-12-09 20:03:46

标签: html css

所以我正在为我的软件工程课程开发一个应用程序,而且我已经修复了我的网页宽度。以下是正在运行的应用程序的云版本的链接:Link to display issue正如您可以看到重新调整框时,标题会更改大小,并在下方创建一个大的白色框,并且始终有一个滚动条即使我的显示器上有最大尺寸,也是最低的。

html, body {
  padding: 0px;
  margin: 0px;
  border: 0px;
  height: 100%;
  width: 100%;
  font-size: 100%;
}
body {
  display: block;
  background-color: #f7f7f7;
}
body, header, footer, h1 {
  font-family: 'Lato', sans-serif;
}
#wrapper {
  width: 100%;
  height: 100%;
  margin: 50px auto;
}
.button {
   width: 240px;
   height: 45px;
   -webkit-border-radius: 2px;
      border-radius: 2px;
   margin: 0 auto;
   cursor: pointer;
}

.facebook {
  margin-bottom: 25px;
  background-color: #A0BBD6;
  -webkit-transition: background-color .2s ease;
      -moz-transition: background-color .2s ease;
      -ms-transition: background-color .2s ease;
      -o-transition: background-color .2s ease;
      transition: background-color .2s ease;
}
.facebook:hover {
  background-color: #88a5c2;
}
.submit {
  margin-top: 20px;
  background-color: #a6d7a0;
 -webkit-transition: background-color .2s ease;
    -moz-transition: background-color .2s ease;
    -ms-transition: background-color .2s ease;
    -o-transition: background-color .2s ease;
      transition: background-color .2s ease;
}
.submit:hover {
  background-color: #93c08e;
}
p {
  text-align: center;
  color: #FFFFFF;
  padding: 0 300px;
  font-weight: 300;
  font-size: 0.8em;
}
.form {
  border: thin solid #ededed;
  position: relative;
  margin: 30px auto;
  width: 290px;
  height: auto;
  background-color: #ffffff;
  padding: 30px 0;
  -webkit-border-radius: 2px;
      border-radius: 2px;
}
  input[type=text] {
  background: url(http://imageshack.com/a/img812/1096/y67f.png) no-repeat 15px 13px;
}

input[type=password] {
  position: relative;
  top: -5px;
  background: url(http://imageshack.com/a/img812/6980/lcnq.png) no-repeat 15px 13px;
}

input[type=text], input[type=password] {
  width: 195px;
  height: 40px;
  -webkit-border-radius: 2px;
      border-radius: 2px;
  margin: 0 auto;
  display: block;
  border: none;
  background-color: #EBEBEB;
  padding: 2px 0 2px 45px;
  -webkit-background-size: 18px;
     -o-background-size: 18px;
      background-size: 18px;
  font-size: 15px;
  font-weight: 300;
  color: #777;
  -webkit-transition: background-color .2s ease;
      -moz-transition: background-color .2s ease;
      -ms-transition: background-color .2s ease;
      -o-transition: background-color .2s ease;
      transition: background-color .2s ease;
}

input[type=text]:focus, input[type=password]:focus {
  outline: none;
  background-color: #f3f3f3;
}

img {
  width: 24px;
  height: auto;
  display: block;
  margin: 0 auto;
  padding: 11px 0;
}
#header {
  padding-left: 50px;
  position: relative;
  width: 100%;
  height: 50px;
  font-size: 2.0em; 
}
h1 {
  font-size: 1.0em;
  font-color: black;
}
#navigationBar {
  width: 100%;
  background-color: #980000;
  height: 30px;
  text-align: right;
}
#footer {
  width: 100%;
  height: 40px;
  position: relative;
  background-color: #980000;
  min-width: 100%;
  padding-bottom: 0;
}
div {
  display: block;
}
a.navButton:link,a.navButton:visited {
  color:#000000;
  text-decoration:none;
}
a.navButton:hover,a.navButton:active {
  color:#FFFFFF;
  text-decoration:none;
}

2 个答案:

答案 0 :(得分:0)

这是因为填充添加到宽度

标题上使用box-sizing: border-box,例如

#header {
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
}

这是Fiddle

答案 1 :(得分:0)

您的页眉和页脚是问题所在。

首先,拿走填充物:0 300px;从页脚>然后在标题标签上取走宽度:100%,因为它确实不需要。