Both are necessary. id's can't be repeated, so when multiple elements need to be identified we use classes. When there is only one on a page we can use the id and we will.
class="" is not just for styling.
The code in the .css file is the styling. You can style based on an id, class, tag name, or just about anything else. HTML is html and .css is the styling.