for example: if i want to create a checkbox for choosing 2 out of say 3 types of fruits-so can this be done by writing the code in different ways as written below?
wow i just typed in 6 lines of code for explaining what i am doing and when i submit, the code typed in vanished. how am i supposed to ask for help? anyways, i am asking is it important to nest the element inside the or can it be done without using the label element?
This looks better and will oblige proper html practices. But you can improve it by adding the For attribute.
And this here is not a good way to write html because your browser has predefined browser styles which makes it to display whatever text you type in your editor.