0

HTML Input tag for tabbed menu

Trying to make tabbed menus. In numerous guides online, they use input and label tag when clicking on the content button. I just want to confirm the attributes for the Input tag first: Like variables in other programming languages, for input type of radio, name is the same for ALL input tags, thus only able to chose ONE name for the 'variable' you chose/create. And the value is ...just the value that will be assigned to the name and used in the server side? ?? But for tabbed menus in HTML/CSS, do I really need the value attribute??? I partially get why we need labels alongside input tags. So that the label or the word itself can be clicked on and does the same thing as clicking on the radio button from the input tag. But why not just write something next to the input tag ??? Like e.g: <input type=radio name=gender value=male>Male <input type=radio name=gender value=female>female And the id attribute just links the label tag with input tag??? Any simple dumb way of explaining it would be very helpful

19th Apr 2019, 8:31 PM
J3fro C
J3fro C - avatar
1 Antwort
+ 1
Just regarding the input/label subquestions: That is the power of semantic markup: It specifies what is actually meant. Of course you could write anything next to the input, but there would not be any chance to actually grasp the context without human interpretation. The "Male" part of your example might be just about anything in any language, or an img or whatever, but if you assign that same text to a label, everything is clear from the start.
19th Apr 2019, 9:47 PM
::sк::
::sк:: - avatar