Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need Help With HTML & CSS Code

Leg_Licker
 Share

Hey, I'm a bit new to coding, I know a bit but still starting out. I'm Just kicking around experimenting with HTML and CSS to just make a simple login page. The issue I'm having is I've tried and tried and tried to get the login box centred to the page, but no luck. if you know a thing or two pls lend me a hand and tell me what I'm doing wrong. Thx In advance!

 

 

Capture.PNG

123.PNG

1234.PNG

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, M.Yurizaki said:

I believe the body needs to be 100% width, otherwise it'll only be as wide as the widest child.

I changed it, still no good

Link to comment
Share on other sites

Link to post
Share on other sites

Have a look at this: https://codepen.io/J-tt/pen/ReJRLQ

 

Centering in CSS is notorious, if you want some different methods have a look at http://howtocenterincss.com/

 

Flex-box is currently the best way to center, and has very wide browser support.

 

Edit: I believe your centering method isn't working due to missing semicolons after 'top' and 'left'

Edited by J_tt
Add information
Link to comment
Share on other sites

Link to post
Share on other sites

Also your classname for the login box in css is .login-box and in html it is "login box"

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, J_tt said:

Have a look at this: https://codepen.io/J-tt/pen/ReJRLQ

 

Centering in CSS is notorious, if you want some different methods have a look at http://howtocenterincss.com/

 

Flex-box is currently the best way to center, and has very wide browser support.

 

Edit: I believe your centering method isn't working due to missing semicolons after 'top' and 'left'

 

2 hours ago, Helibert said:

Also your classname for the login box in css is .login-box and in html it is "login box"

Thank both of you so much figured it out, much appreciated!  

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×