Learn Typography: `div` as divider instead of `hr`?


In going through this fun little course, why at certain parts are we using a div instead of an hr?


<div class="divider large"></div>
<div class="divider medium"></div>


<hr class="divider large"></hr>
<hr class="divider medium"></hr>

Which one is best practice? Which one is semantically correct? What is the reasoning if any behind using a div instead of an hr?

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.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.