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

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
}