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
Mark McGee
199 PointsNeed help with css borders
I am trying to creat a page with a border on each side of the page. It needs to be blue and each border must be as high as the page. Any suggestions?
3 Answers
Matthew Willmott
9,426 PointsHow about applying a border-left and border-right to your body (if the body is full screen)? If the body isn't full screen then try applying the border-left and border-right to the html, so something like this:
html {border-left: 20px solid blue; border-right: 20px solid blue;}
For some reason, when I just tested that it didn't work when a height of 100% was defined, but worked fine if you had "height: auto;" or no height defined at all on the html.
I imagine there must be an easier way to achieve this so hopefully others will post with other/better suggestions.
James Barnett
39,199 PointsHere's an working example: http://codepen.io/barnettjw/pen/tkIAb
body {
/* give the box dimensions */
height: 1000px;
width: 50%;
/* center it on the page */
margin: 50px auto;
/* give it blue borders on the left & right */
border-left: solid blue;
border-right: solid blue;
}
Kris Jolls
5,157 Pointsyou can also apply a pixel width.
border-left: 2px solid blue;
For example.