Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Responsive Layout

Kate Massie
seal-mask
.a{fill-rule:evenodd;}techdegree
Kate Massie
Front End Web Development Techdegree Student 7,062 Points

How to style <hr>

Hi, I'm working on the Responsive Website project and I'm stumped on how to add a horizontal rule to the bottom of the page (just below the "Contact" section) that doesn't stretch all the way across the page.

I tried adding a bottom border to the Contact section, with margins to stop it before the edge of the page, but that left white space to the left and right of the Contact section.

I tried inserting an <hr> but if I give it margins, again white space appears to either side of the rule. Padding does not seem to have an effect, and I know the width property is not supported in HTML5.

Another strange thing that's happening is that when I delete the <hr> from my HTML, it continues to appear on the website.

Any help would be greatly appreciated, thank you!

1 Answer

anil rahman
anil rahman
7,786 Points
hr {
   width: 50%; --control width by pixels or percent
    border: none; --get rid of thickness
    height: 1px; -- redifine thickness with height
    background-color: #000;  --set colour
}