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 trialkaran Badhwar
Web Development Techdegree Graduate 18,135 Pointsmargin problem
How come we were not able to adjusts two elements on one Line and then we added 4% of margin too and still the other element did not fall down? we had to give -4px initially to manage both of them into one line and then we added 4% which is approx 25px and both the Elements manage to adjust?
1 Answer
Jason Larson
8,359 PointsNote 2 things when the 4% is added. First, the size of the columns is changed from 50% to 48%. With 2 columns, this would leave 4% extra. The other thing to note is that when the 4% is originally added, you had the same problem where the second column fell down below the first. The pictures only display correctly when calc()
is used to set the margin to calc(4% - 4px)
, which covers the extra pixels that were needed to keep the second column on the same line.