Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Ben Watson
Ben Watson
1,399 Points

If I am not supposed to use html for its aesthetic elements why would I ever use <hr> instead of <br>?

<hr> and <br> do pretty much the same thing except for <hr> making a visible line across the page. If I am not supposed to use html for aesthetics (because thats what CSS is for) why would I ever use <hr>?

3 Answers

Tim Knight
Tim Knight
28,888 Points

Hey Ben,

Keep in mind both of those tags have been around since the earlier days of HTML when we were looking at HTML documents from the perspective of how they might look without the use of CSS at all. I think with things like <hr> though that can still be useful in creating visual separation and your CSS can control the look and style of your horizontal rule.

Hi Ben,

To be honest I cannot remember myself using <hr/> on any site, but it might be good for accessibility and to emphasis the semantics of the context. I also think screen reader handle <hr/> different from bottom borders or just thin divs (which can be changed through aria-labels). If it's just a matter of aesthetic I would use CSS to get a horizontal rule.

Hey Ben,

I agree with what both Hakim and Tim stated.

It's my personal belief that you should try to utilize HTML for building the "skeleton" of the site. Then, you leave spacing/styling up to CSS. As you dive deeper into HTML/CSS and Front-End coding, you'll realize that most developers today utilize frameworks like Bootstrap, UI Kit, or Framework. So whether you, right now, utilize <hr> or <br> to create breaks won't really be important once you start utilizing frameworks.

My suggestion would be to look at a few of your favorite websites/blogs and see how they utilize these elements. That may give you a greater understanding of the context's in which you'd use these elements.