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

mrx3
mrx3
8,742 Points

I got a broken box error with CSS lint?

I have a class with padding and height in the same declaration, CSS below:

.header-section {
  padding-top: 3px;
  height: 115px;
  background-color: black;
}

The error from CSS lint says, "Using height with padding-top can sometimes make elements larger than you expect."

I did setup the box-sizing rule to.Is this something I should change, or is CSS lint being too picky? Thanks in advance for any answers.

1 Answer

Jacob Miller
Jacob Miller
12,466 Points

It's not really an error, just a warning. Your .header-section will take up 118px of space vertically because you have to add the 3px of padding to the 115px height.

If you use box-sizing: border-box, it will apply the padding to the inside of the element, making the header take up 115px of vertical space, with the 3px of padding applied inside of the element instead of outside of it. So in other words, it's just a warning to make sure you are aware of it, but you don't necessarily have to change it unless you want to.

mrx3
mrx3
8,742 Points

Thanks Jacob.