+ 3
Why my background is not covering all page and why my login box is not in the middle?
Position:absolute; Right:50%; Left:50%; Top 50%; And the box is not in middle And background also is position:covered https://code.sololearn.com/WXxDEAuV7joS/?ref=app
41 Answers
+ 10
Add this
#login-box {
position:absolute;
top:20%;
left:30%;
right:20%;
+ 9
It works good š
+ 1
easier to just set html, body { hieght: 100%}
+ 1
#login-box {
position:absolute;
top: 30%;
left: 30%;
}
keep in mind i did it on my phone and you need to code for responsiveness for it ti work on diffeent devices
+ 1
I went with this so it adds a legend to your login box. You just need to play around and center it. <fieldset id="login-box">
<legend><h3>Login</h3></legend>
!<-- your html -->
</fieldset>
+ 1
automatic centering could be achieve thanks to combination of absolute positioning and translate transform:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
+ 1
Use transform: translate (-50%, -50%);
Really works
+ 1
#login-box {
margin:auto;
padding-top:50%;
width:50%;
}
0
This don't help it become even smaller with ba kground size
0
Thanx but the login box ain't in middle with position static the login box is in middle with some random 30 35% numbers not with 50 in exactly middle
0
as well as background
0
Doesn't work
0
body, html {
height:100%;
width:100%; background-image:url("https://image.freepik.com/free-photo/great-view-park-with-city-background_1203-651.jpg");
background-repeat:no-repeat ;
font-family:sans-serif;
background-size: cover;
}
0
that works
0
You just added , html to the body {} ?
0
then rotate lol thats why there is a comma and plus the order doesnt matter
0
the comma seperates them
0
background-size cover; as well
0
But why the login box is not in the midle?
https://code.sololearn.com/WXxDEAuV7joS/?ref=app
0
Ah well how can i make the picture look better on page?