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 trialKate Massie
Front End Web Development Techdegree Student 7,062 PointsHow 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
7,786 Pointshr {
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
}
Kate Massie
Front End Web Development Techdegree Student 7,062 PointsKate Massie
Front End Web Development Techdegree Student 7,062 PointsThanks for your reply! This leaves a margin on either side of the <hr>. The margin is white, so it's noticeable on the light gray background. I set the margins to "0 auto" to center the <hr>. Thanks in advance!
Kate Massie
Front End Web Development Techdegree Student 7,062 PointsKate Massie
Front End Web Development Techdegree Student 7,062 PointsNevermind, I fixed it! Thank you!