Skip to content

Instantly share code, notes, and snippets.

@X-Bird
Last active December 21, 2015 02:39
Show Gist options
  • Save X-Bird/6236854 to your computer and use it in GitHub Desktop.
Save X-Bird/6236854 to your computer and use it in GitHub Desktop.
常见兼容方案 css snippets
// inline-block
.inline-block-compatible() {
display: inline-block;
*display: inline;
*zoom: 1;
}
// 最小高度 min-height
.min-height-compatible(@height) {
min-height: ~'@{height}px';
_height: ~'@{height}px'; /* hack for ie6 */
}
// 顺时针翻转 90 度。
.transform-rotate-compatible () {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
transform: rotate(90deg);
}
// 兼容ie6 div 半透明
.opacity-compatible(@num) { /* make the div translucent */
opacity: @num/100;   /* Firefox, Safari(WebKit), Opera) */
filter: ~'"alpha(opacity=@{num})"';   /* IE 8 */
filter: alpha(opacity=@num);   /* IE 4-7 */
zoom: 1;   /* needed in IE up to version 7, or set width or height to trigger "hasLayout" */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment