
Gabriel F. answered 10/30/19
Full Stack Software Developer and Mentor
Hi there. The "name" attribute is normally used in form elements so the server can identify fields on form submission. If you want to identify your elements, you can use the "id" attribute or the "class" attribute. As a rule of thumb "id" must be unique per page. "Class" on the other hand is normally used for a group of elements that have similar semantic roles on a page and whose style will be the same, such articles in a page that displays a list of articles to choose from.
As far as CSS, the "id" selector has more specificity than a "class" selector. For instance, in the example below the ruleset for the id selector prevails over the ruleset for the class selector (if you run this example on your local environment you will see a 200px by 200px red square).
I hope this helps!