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

HTML How to Make a Website Styling Web Pages and Navigation Style the Portfolio

pat barosy
pat barosy
6,759 Points

2.5% margin to = 10%?

How does 2.5% margin equal 5% for each of the two floated images when he only considered the left and right margins? Doesn't margin: 2.5% mean 2.5% top, bottom, left side, right side? That would give a total of 10% for each image

1 Answer

Hi Pat,

That's a good question.

The reason is because you're using a float.

Go back to your main.css. Try typing out "float:" in your CSS and you will set a drop down list with these options to choose from: none, left, right, inherit. There are no options for top or bottom, so top and bottom will not change when using the float.

The width must be specified because with the float property, the objects are being taken out of the normal flow of the document. Since the float only goes by left and right, the margin you specify tells the browser to apply the margins only to the left and right.