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
Leo Effert
3,704 PointsProblem centering my content. Everything seems to be floated to the left.
body { width: 800px; text-align: center; background-color: lavender; background-image: url(bild7.jpg); background-size: cover; }
header { text-align: center; border: 3px solid black; background-image: url(bild6.jpg); background-size: cover; height: 500px; margin-left: 30px; margin-right: 30px; }
.main-header { padding-bottom: 60px; font-size: 70px; }
.johanna { width: 25%; border-radius: 10%; }
.all-text { font-size: 60px; margin: 0; }
.all-img { width: 25%; border: 3px solid black; }
2 Answers
Ine Van Severen
7,018 Pointshiya,
your body is taking the centre of 800px (the width you gave it)
If you put the width to 100% you will see your content will be in the centre :)
Ine Van Severen
7,018 PointsYou can as well leave the width to 800px and add a margin rule to be auto
body {
width:800px;
margin:auto;
text-align:center;
background-color: lavender;
background-size: cover;
}
Leo Effert
3,704 PointsLeo Effert
3,704 PointsI see, but how do I change the size then?