Skip to content

Set default box-sizing to border-box#409

Closed
tronsha wants to merge 1 commit into
necolas:masterfrom
tronsha:master
Closed

Set default box-sizing to border-box#409
tronsha wants to merge 1 commit into
necolas:masterfrom
tronsha:master

Conversation

@tronsha
Copy link
Copy Markdown

@tronsha tronsha commented Jan 23, 2015

If you make a responsive design the container is wider than 100%.

.container {
  max-width: 100%; 
  padding: 20px;
}

This fixes the problem.

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

@MoOx
Copy link
Copy Markdown
Contributor

MoOx commented Jan 23, 2015

I've to admit that would be nice. But this rule is more like a reset. So don't have a place in normalize.css.

@necolas
Copy link
Copy Markdown
Owner

necolas commented Jan 24, 2015

That would change the browser default and have cascading consequences, affecting the layout of every element in the page. Not suitable for the project.

@necolas necolas closed this Jan 24, 2015
@ramasilveyra
Copy link
Copy Markdown

And if use this version?

html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

The best is preserve inheritance. I hope you consider it's a very common problem.

More:

@battaglr
Copy link
Copy Markdown

@ramasilveyra: that code does the same thing after all: modifies the default box-model; and normalize.css it's not about that.

I understand how useful this is, I use it all the time. But that belongs in your codebase. 😉

Repository owner locked and limited conversation to collaborators Jan 29, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants