Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Bug fixed some methods #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 133 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,166 @@
# Browser Hack Mixins for Sass

### Apply your CSS to a specific browser




![Browser Hack Mixins for Sass](https://i.ibb.co/Jy0W77m/browsers.png)

![Browser Hack Mixins for Sass](https://lh3.googleusercontent.com/-lCHyETA5vtw/Vv7N8psFLDI/AAAAAAAACPg/0aPgHIty5YQ9Tp-eubIPgox5oBcWTJJNgCCo/s1024-Ic42/browser-logos.png)

## Requirements
- Sass 3.3+

- Sass 3.3+



## How To Use



1. Import `_hacks.scss` file to your SCSS code : `@import "hacks";`

2. Use the mixin you want:
- `@include [Mixin_Name]( 'selector', (property: value) )`
- For example:

- `@include [Mixin_Name]( 'selector', (property: value) )`

- For example:

```

@include only_ie9( '.my_element', (color: red))

```

Or:

```

@include only_ff28_above( '.my_element', (
background-color: green,
display: flex,
margin: 2em,

background-color: green,

display: flex,

margin: 2em,

))

```

## List of Mixins

1. Firefox CSS Hacks
- only_ff
- only_ff2
- only_ff2_above
- only_ff3_above
- only_ff6_above
- only_ff16_above
- only_ff21_above
- only_ff24_above
- only_ff25_above
- only_ff26_above
- only_ff27_above
- only_ff28_above
- only_ff30_above

- only_ff

- only_ff2

- only_ff2_above

- only_ff3_above

- only_ff6_above

- only_ff16_above

- only_ff21_above

- only_ff24_above

- only_ff25_above

- only_ff26_above

- only_ff27_above

- only_ff28_above

- only_ff30_above

2. Webkit CSS Hacks
- only_webkit
- only_chrome
- only_safari
- only_safari9
- only_ios
- only_safari_no_ios
- only_opera9_safari2

- only_webkit

- only_chrome

- only_safari

- only_safari9

- only_ios

- only_safari_no_ios

- only_opera9_safari2

3. Opera CSS Hacks
- only_opera
- only_opera11

- only_opera

- only_opera11

4. Internet Explorer CSS Hacks
- only_edge
- only_ie6
- only_ie7
- only_ie7_below
- only_ie8
- only_ie8_below
- only_ie9
- only_ie9_below
- only_ie10_above
- only_ie11
- only_ie11_above
- no_ie6
- only_ie9_saf4_above

- only_edge

- only_ie6

- only_ie7

- only_ie7_below

- only_ie8

- only_ie8_below

- only_ie9

- only_ie9_below

- only_ie10_above

- only_ie11

- only_ie11_above

- no_ie6

- only_ie9_saf4_above

5. Other CSS Hacks
- no_ie_safari6

- no_ie_safari6



## Tips
- Use firefox mixins before IE mixins. Sometimes Firefox wants to precess the IE css but it can't and skips it's own CSS!

- Use firefox mixins before IE mixins. Sometimes Firefox wants to precess the IE css but it can't and skips it's own CSS!



## What's New
- Added Microsoft Edge mixin
- More styles on each mixin
- Fixed 'only_safari' mixin
- Fixed firefox mixins

- Added Microsoft Edge mixin

- More styles on each mixin

- Fixed 'only_safari' mixin

- Fixed firefox mixins



## Thanks to
- [marknotton](https://github.com/marknotton)
- [1forh](https://github.com/1forh)

- [marknotton](https://github.com/marknotton)

- [1forh](https://github.com/1forh)



## Share this!
[![share](https://static.addtoany.com/images/blog/tweet-button-2015.png)](https://twitter.com/intent/tweet?text=Browser-Hack Mixins for Sass%20-%20https://github.com/saadeghi/browser-hack-sass-mixins/)

[![Share](https://static.addtoany.com/images/blog/tweet-button-2015.png)](https://twitter.com/intent/tweet?text=Browser-Hack%20Mixins%20for%20Sass%20-%20https://github.com/saadeghi/browser-hack-sass-mixins/)
27 changes: 12 additions & 15 deletions _hacks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,17 @@
}
}

/*--- Only Safari ≥ 6.1 ---*/
// Dark magic, Don't touch
@function sf_func1($selector, $property) {
@return '@media screen and(min-color-index:0)and(-webkit-min-device-pixel-ratio:0){@media{'+& $selector+'{'+$property;
}
@function sf_func2($value) {
@return $value+'}}}';
}
@mixin only_safari($selector, $map){
@at-root{
@each $property, $value in ($map) {
#{sf_func1($selector, $property)}: #{sf_func2($value)};
}
}
/*--- Only Safari ---*/
@mixin only_safari($selector, $map) {
@media not all and (min-resolution:.001dpcm){
@supports (-webkit-appearance:none) {
#{$selector} {
@each $property, $value in ($map) {
#{$property}: $value;
}
}
}
}
}

/*--- Only Safari ≥ 9 ---*/
Expand Down Expand Up @@ -321,7 +318,7 @@
// ----------------------------------- */

@mixin only_edge($selector, $map){
@supports (-ms-accelerator:true) {
@supports (-ms-ime-align: auto) {
#{$selector} {
@each $property, $value in ($map) {
#{$property}: $value;
Expand Down