HTML 5 label and input element

Is this the correct code for the following exercise?
  Create a label element with the text Username.  Within the label element, insert an input box for the   username field.  Make the field required and add the title Supply your username
<label>
   Username *
    Supply your user username
     <input name="username" id="username"  required="required"/>
</label>

Is this the correct code for this exercise?
Create a label element with the text Password containing an input box for the password field.  Set the data type to password and make the field required.  Add the title You must provide your password.
<label for="password">Password *</label>
You must provide your password
<input name="password" id="password" required="required"/>
cookiejarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobOwner (Aidellio)Commented:
We can't tell you directly given this is of an academic nature but we can guide you.

Have you looked up any html reference for setting these properties?  Start here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element

I can say you're almost there but it's not 100% correct.
cookiejarAuthor Commented:
I guess my question should have been,  does the display input box within the label element indicate the input box is nested with the label?  Also is title an attribute of the input element?  I didn't see it listed as an attribute in your referenced link nor my textbook.

I am also trying to decipher whether the following instruction means to nest the input box within the label or to use the for attribute?

Create a label element with the text Password containing an input box for the password field?
RobOwner (Aidellio)Commented:
Read the summary here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label.  It will describe how to use the label and what its options are.

As for the "title" that is obscure to me too.  I believe it is saying to just have that text associated with your input element.
Snarf0001Commented:
Just to throw in here...
title attribute is very useful.  It comes into play when using native browser validation methods:

https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms_in_HTML

Though the link is a tad misleading, apart from a tooltip, most browser will render the title as the actual error message for the user.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.