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
erdragerdragsson
Courses Plus Student 5,887 Pointscentering problem!
When i put 5% padding on wrapper, it just add padding on the left side, heres a picture of it http://imgur.com/61wW3oy
and my footer and text gets wierd centering placements,
heres my css code!
body {
background: url('../img/background.jpg');
}
header {
background: url('../img/banner.jpg');
padding: 20px;
margin-bottom: 200px;
min-height: 100%;
}
.main-wrapper {
width: 100%;
margin: 0 auto;
padding-left: 5%;
padding-right: 5%;
}
.first-content img{
width: 200px;
height: 200px;
border: 5px solid white;
border-radius: 10px;
}
.first-content {
}
.first-content li {
float: left;
width: 200px;
}
.first-content ul li{
margin: 40px;
}
.second-content p{
color: #FFF;
}
.second-content {
clear:both;
width: 40%;
text-align: center;
position: relative;
margin-left: auto;
margin-right: auto;
border: 5px solid white;
border-radius: 5px;
margin-top: -80px;
text-align: center;
}
footer {
clear:both;
text-align: center;
font-size: 20px;
color: orange;
font-weight: 900;
}
.button {
padding-left: 5%;
padding-right: 5%;
padding-top: 5px;
border: 1px solid black;
border-radius: 20px;
background-color: orange;
text-align: center;
margin-bottom: 2px;
}
.button {
font-weight: bold;
}
.button:hover {
background-color: red;
}
2 Answers
jacob weber
20,743 PointsIt's a little tough to know where some of the issue could be since the HTML code isn't here. But, try setting your wrapper to display:block; and see if that helps at all.
jacob weber
20,743 PointsCouple of quick notes first - you are closing your <p> inside <section class="second-content"> with a </section> rather than a </p> and you are missing the ; after your copyright.
To your question, the padding-right is actually working, it has to do with your width being set to 100%; for instance, try setting your padding-right to a larger value than 5% say like 50% and see what happens. To add space/padding inside the content, consider adjusting your width to being less than 100% - remember your width will be greater than 100% since you are adding padding - reference the box model.
These help a little too: <a href="http://css-tricks.com/almanac/properties/p/padding/" target="_blank" >http://css-tricks.com/almanac/properties/p/padding/</a>
<a href="http://www.w3schools.com/css/css_padding.asp" target="_blank">http://www.w3schools.com/css/css_padding.asp</a>
Hope that is of some help.
erdragerdragsson
Courses Plus Student 5,887 Pointswhen i removed the width of the wrapper, it got centered!
// erdrag
erdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 PointsIll try that tomorow, and see if it helps, and ill get back with result
// erdrag
erdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 Pointsi tried it now, and it didnt help. heres my html code!