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

Oliver Sewell
16,425 Pointsinline-block , why do we add -5px margin-right
if the max-width of the page is 100% and one of the two columns is 60% and the other 40% why do i need to add margin-right to make them sit side by side?
* {
box-sizing: border-box;
}
#wrapper {
max-width: 100%;
margin: 0 auto;
}
.col {
display: inline-block;
padding: 10px;
margin-right: -5px;
vertical-align: top;
height: 200px;
}
.primary-content {
background: lightblue;
width: 60%;
}
.secondary-content {
background: pink;
width: 40%;
}
1 Answer

rydavim
18,814 PointsInline-block elements have some default white space associated with them. CSS Tricks wrote a whole article on ways to get rid of this space. Using negative margins is a common method for removing unwanted space between inline-block elements.
Oliver Sewell
16,425 PointsOliver Sewell
16,425 Pointsahhh thankyou for refreshing my memory,will have to make a note of this!