One thing that confuses me is i thought labels had to have a for=“name” that matched a inputs id=“name”. When i put a for=“” in the labels for front-end-projects, back-end-projects and data-visualization it had an X and wanted an id=“” instead.
Can someone help me out so i understand that please?
this is the specific part where it wanted an id=“” inside the label. Previously we had been taught to put for=“” matching the id=“” of the input it corresponded to. Does that answer your question?
Not sure. The for attribute is something different than the id. You can add a for attribute in the same tag as the id. Just make sure your for attribute is equal to the value of the inputs id.
step 58 also has us do the for=“” again to match the id=“” but never asks us to put an id=“” in the label. So as of right now i have NO idea why i’d want an id=“” inside my label if i already have a for=“” linking it to the input id=“”
Yes so I think I see what is confusing you. The test doesn’t require a for because, I guess, it simply doesn’t care about accessibility. While the step doesn’t require an id because it doesn’t need that attribute in the label to link the label and the input. The id is needed in the test because the test wants to know if you’ve complied with the requirements to pass you.