I have been trying to create a form using css grid for a few days,but I run to a few problems I can’t figure out.Here is the problem :
- I can’t make my header cover entire top of my form
- I also try to add border to my label to test it,however the “password” label did not have border applied to it and when I click on “password” label it didn’t trigger the input
- Swapping input and label in html will mess the layout,I do this so I can style the label when input is focused
Here is my html and css: https://codepen.io/James_z/pen/WKRXOG
Any help will be appreciated
Just some observations…
Sign Up is part of your form so the padding on that form element applies to your h1. h1 also comes with some top margin by default. I would wrap the form in a div, take that outside of the form and probably not use h1. h1 is not for formatting text
You don’t have border on email label because of small typo - missed a quotation mark after type="email
<input id="email" name="email" type="email>
I’m not not sure what your styling plan involves but putting labels before the input in your html would greatly simplify things. Right now your labels are aligned with the following input, not the input they are labelling (First Name is in front of Last Name input field).
<input id="email" name="email" type="email">
After thinking about that some I realized what you wanted (I think). You wanted the label to be after input so you could use
+ selector to target label style when input is focused. I’m sure there are other ways but I would use the order property on the input to do that.
See if this does what you want…
Thank you everyone for the help,I really appreciate it :),first problem and second problem have been fixed,however third problem seem to be more tricky,changing the order property make the layout broken,I think I am going to put the label before input instead