Reputation: 305
I have unwanted vertical scrollbars in all browsers even if the content does not occupy the entire page. Improvement and changes to css are welcome!
<div id="header">
</div>
<div id="container">
<div id="title"><h2>Admin</h2></div>
<div id="content">
<div class="login">
<div> </div>
<form method="post" action="/admin/index.php">
<p><input type="text" name="username" value="" placeholder="Username"></p>
<p><input type="password" name="password" value="" placeholder="Password"></p>
<p><input type="submit" name="login" class="button" value="Send"></p>
<p class="error"> </p>
</form>
</div>
</div>
</div>
<div id="footer">
<p>Copyright © 2010-2013</p>
</div>
this the css file
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 85%;
color: #333399;
}
#header{
min-height:15%;
}
#container {
min-height:80%;
margin-left:auto;
margin-right:auto;
width:70%;
}
#footer {
text-align: center;
min-height:5%;
}
#title{
position:relative;
background-color:#BAB3D6;
padding:10px 0px 10px 10px;
margin-left:auto;
margin-right:auto;
margin-bottom:3px;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
#content{
padding:5px 5px 5px 5px;
border:2px solid #BAB3D6;
position:relative;
margin-left:auto;
margin-right:auto;
margin-bottom:30px;
-webkit-border-bottom-right-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-bottomright: 10px;
-moz-border-radius-bottomleft: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.button{
background-color:#BAB3D6;
border:0px;
display:inline-block;
padding:6px 20px;
text-decoration:none;
color: #333399;
cursor:pointer;
}
.button:hover {
background-color:#0061a7;
color: white;
}
.button:active {
position:relative;
top:1px;
}
.error{
font-weight: bold;
color:red;
}
form input[type="text"] {
border: 2px solid #BAB3D6;
font-size: 85%;
color: #333399;
font-family: Arial, Helvetica, sans-serif;
padding: 3px;
}
form input[type="password"] {
border: 2px solid #BAB3D6;
font-size: 85%;
color: #333399;
font-family: Arial, Helvetica, sans-serif;
padding: 3px;
}
.login p {
text-align: center;
}
====UPDATE=====
I have fix it with body height 99%
Upvotes: 0
Views: 3333
Reputation: 3763
simplest solution without editing ur css
Remove height:100%; from body
html, body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 85%;
color: #333399;
}
Upvotes: 0
Reputation: 3131
I saw the scroll bars, but only when I play with the window size. I think since you are using % for height, you can eliminate the #container min-height:80%;
tag as this will eliminate the overflow/scrollbar issue.
When you use the header at 15% and the footer at 5% the remaining 80% is automatically filled with the container.
Another option could be to use the position:relative
tag in the header and add a top:15%;
to dial in the header positon. Or you could offer up a min-height:10%;
and max-height:15%;
to dial in the header size in total.
If you want the footer to always remain at the bottom, you can set position:relative bottom:5%;
within it's css
Upvotes: 0
Reputation: 2670
Take the minimum height out of your CSS elements. Here is an example. And here is what you want to do to your CSS code:
#container {
margin-left:auto;
margin-right:auto;
width:70%;
}
This should fix any problem with that vertical scroll bar.
Upvotes: 1