Bo Master into the front-end course of study also on 1 weeks, including himself, many students around the ID, name, classs the properties of the three tags are not very clear, so after consulting the relevant information, made their own knowledge within the scope of the following summary:
For example, ID is like identity card identification number, each person's identity card number is not the same, is unique; name is like the name on the ID card, it is just a code name, it is not unique; the gender, Han, and class attributes on the identity card are similar and are collectively referred to as a category.
A simple picture of an ID card should be able to accurately distinguish the differences between the three, let's look at their respective uses:
First, ID
First we know that the ID is unique in a Web page, and it is used more when contacting the background. To the Bo master at this stage of learning, ID has not yet entered the field I have learned to master.
Second, name
The name attribute appears more in the tagged elements that have been learned than the ID, most often in <input> and anchor points.
Applications in the 1.<input>
<type= "Radio" name= "Sex"/> male < type = "Radio" name = "Sex"/> Female
For the above code, when choosing the gender, we need to appear a single radio, so for two input tags, need to name the same name.
2. Anchor Point
< H3 >< name= "Maodian"></a> title </h3 ><href= "#maodian"> jump to Title </a>
Third, class
Class is the kind of setting tag that is used to set the CSS style, as compared to ID and name. Just as we need to extract the Han population in a city of tens of millions of people, your name will not affect this.
The above is the Bo master on the ID, name, class, a summary of the three differences, because only contact it, it is not possible to do in-depth analysis and comparison, of course, I hope this blog can give beginners a help, but also welcome us to discuss with each other, common progress!
In the HTML, the difference between ID, Name, class three