there is more than one way to do something like this.
reasons why you choose one or the other depends on what you are trying to accomplish.
For eg. here’s a question asked online about using div vs hr vs a border to make a line. You can see the response to that as one reason why someone would choose hr (screen-readers acknowledge them as divisions semantically).
So the answer is: it depends on what you care about, what is easy, what is useful, and the answer will change depending on what you are doing and your audience.