1 @function inner-border-spread($width) {
4 $bottom: bottom($width);
7 @return min(($top + $bottom) / 2, ($left + $right) / 2);
10 @function inner-border-hoff($width, $spread) {
12 $right: right($width);
15 @return $left - $spread;
18 @return $spread - $right;
22 @function inner-border-voff($width, $spread) {
24 $bottom: bottom($width);
27 @return $top - $spread;
30 @return $spread - $bottom;
34 @function even($number) {
35 @return ceil($number / 2) == ($number / 2);
38 @function odd($number) {
39 @return ceil($number / 2) != ($number / 2);
42 @function inner-border-usesingle-width($width) {
44 $right: right($width);
45 $bottom: bottom($width);
49 @if $left + $right == 0 {
52 @if $bottom >= $left + $right {
58 @if $left + $right == 0 {
61 @if $top >= $left + $right {
67 @if $top + $bottom == 0 {
70 @if $right >= $top + $bottom {
76 @if $top + $bottom == 0 {
79 @if $left >= $top + $bottom {
84 @if $top + $bottom == $left + $right and even($top) == even($bottom) and even($left) == even($right) {
91 @function inner-border-usesingle-color($color) {
93 $right: right($color);
94 $bottom: bottom($color);
97 @if $top == $right == $bottom == $left {
104 @function inner-border-usesingle($width, $color) {
105 @if inner-border-usesingle-color($color) and inner-border-usesingle-width($width) {
111 @mixin inner-border($width: 1px, $color: #fff, $blur: 0px) {
112 @if inner-border-usesingle($width, $color) {
113 $spread: inner-border-spread($width);
114 $hoff: inner-border-hoff($width, $spread);
115 $voff: inner-border-voff($width, $spread);
116 @include single-box-shadow($color-top, $hoff, $voff, $blur, $spread, true);
119 $width-top: top($width);
120 $width-right: right($width);
121 $width-bottom: bottom($width);
122 $width-left: left($width);
124 $color-top: top($color);
125 $color-right: right($color);
126 $color-bottom: bottom($color);
127 $color-left: left($color);
130 $shadow-right: false;
131 $shadow-bottom: false;
135 $shadow-top: $color-top 0 $width-top $blur 0 inset;
137 @if $width-right > 0 {
138 $shadow-right: $color-right (-1 * $width-right) 0 $blur 0 inset;
140 @if $width-bottom > 0 {
141 $shadow-bottom: $color-bottom 0 (-1 * $width-bottom) $blur 0 inset;
143 @if $width-left > 0 {
144 $shadow-left: $color-left $width-left 0 $blur 0 inset;
147 @include box-shadow($shadow-top, $shadow-bottom, $shadow-right, $shadow-left);