Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Use improved box-sizing reset
Browse files Browse the repository at this point in the history
- More on the syntax here http://bit.ly/1qk2tVR
- Closes #196
  • Loading branch information
Reda Lemeden committed Jul 18, 2014
1 parent ced0c2e commit 8e8b695
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/_neat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Grid
@import "grid/private";
@import "grid/reset";
@import "grid/grid";
@import "grid/box-sizing";
@import "grid/omega";
@import "grid/outer-container";
@import "grid/span-columns";
Expand Down
11 changes: 11 additions & 0 deletions app/assets/stylesheets/grid/_box-sizing.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@if $border-box-sizing == true {
html { // http://bit.ly/1qk2tVR
@include box-sizing(border-box);
}

* {
&, &:before, &:after {
@include box-sizing(inherit);
}
}
}
5 changes: 0 additions & 5 deletions app/assets/stylesheets/grid/_grid.scss

This file was deleted.

15 changes: 15 additions & 0 deletions spec/neat/default_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'

describe "By default" do
before(:all) do
ParserSupport.parse_file("default")
end

it "sets sizing on the html element to 'border-box'" do
expect('html').to have_rule('box-sizing: border-box')
end

it "sets sizing on the global selector to 'inherit'" do
expect('*:after').to have_rule('box-sizing: inherit')
end
end
2 changes: 0 additions & 2 deletions test/_setup.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
$border-box-sizing: false;

@import 'bourbon/bourbon';
@import 'app/assets/stylesheets/neat';
1 change: 1 addition & 0 deletions test/default.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'setup';

6 comments on commit 8e8b695

@Freekbron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to @include box-sizing(border-box); on *, *:before, *:after to overwrite this, because I use this in my project:

content {

max-width: 1020px;
margin: 0 auto;
padding: 0 3.125%;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}

Every % calculated div inside of my #content section collapsed.

@kaishin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Freekbron Please use the setting provided to turn this behavior off http://thoughtbot.github.io/neat-docs/latest/#border-box-sizing

@Freekbron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaishin Thanks, much cleaner this way!

@Freekbron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@import "neat"; $border-box-sizing: false;

Doesn't do anything for me. Any thoughts?

@joshuaogle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Freekbron You'll want to do it the other way around ($border-box-sizing: false; @import "neat";) since it's already adding the code before you set it to false

@Freekbron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshuaogle Sweet!

Please sign in to comment.