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 HTML Text Emphasis, Strong, and Horizontal Rules

Horizontal Rule <hr>

Can you adjust the width of the horizontal rule?

4 Answers

Thanks for the quick reply. No, I haven't tried, I am watching the HTML videos and just was curious. How would you do it?

You'd do

hr {
    width: 500px;
}

You can do more with it as well, such as the height, colour, borders, etc. Google around, and test it out in CSS :)

Jeremy Castanza
Jeremy Castanza
12,081 Points

Paul, this is a little bit more advanced... but typically you'd have a horizontal rule in a containing element such as a section or div - meaning that you typically wouldn't need to define the width of the horizontal rule itself. By defining the width of the containing element, the width would automatically be applied to the horizontal rule. It's something that's covered more in the realm of CSS.

Try not to get into the habit of defining widths for every element - it's a easy thing to do as a beginner and it causes a lot of heartburn later on as you become a more experienced web designer (i.e. rookie mistake). Once you learn CSS, this advice will make much more sense.

You should be able to. Is it not working for you?

Cool beans. Thanks a lot!