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 trialJackson Monk
4,527 PointsWhy does padding not attach to right side?
Why does this padding not cling to the right side on the right like it does on the left?
<html>
<head>
<style>
#footer {
position: relative;
padding: 100px;
left: -20px;
right: -20px;
background-color: black;
}
</style>
</head>
<body>
<div id = footer>
</div>
</body>
</html>
3 Answers
Alexandru Noti
8,444 Points<head>
<style>
#footer {
padding: 100px;
left: -20px;
right: -20px;
background-color: black;
}
</style>
</head>
<body>
<div id = "footer">
</div>
</body>
</html>
Try this code!
Antonio De Rose
20,885 Pointsdid you want
padding-right : 100px;
Jackson Monk
4,527 PointsNo, I was wondering why
right: -20px;
does not make the padding attach to the right side like it does to the left
Alexandru Noti
8,444 Points<div id = footer> is not right try <div id="footer">
Jackson Monk
4,527 PointsThat can't be the problem because it attached to the left side, so I know it selected it
Jackson Monk
4,527 PointsJackson Monk
4,527 PointsThanks for your help but I have figured it out by placing an absolute div inside the relative div, then using that code :)