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

CSS

I get extra margin, and I dont know from where it comes up

here is a link to my repo https://github.com/flajus1/Project_3

I have inputs in contact information, when I set width to 100% ir forces the margin and everything looks okay, but if I set max-width:100% the margin from right side shows up, and I think thats why my breakpoint at 768px doesnt work, because I want to use flexbox to do the styling, and also I set max-width to textarea and button, but there is no margin, and they are still shrinked up.

Because of the Box-Model of CSS, the margin is added AFTER the width is declared.

Here, the element is set to 100%, and then the additional padding and margins are added.

An option around this is using the box-sizing: border-box which adds the padding and borders and then calculates the remaining 100%, without the bottom scrollbar

1 Answer

Thank you Jason for your answer, but the problem was elsewhere, if I remember corectly it was on line 55, the input element had display:block, thats why the margin was added

I apologize, I misunderstood the question.