作者:叮2011_923 | 来源:互联网 | 2023-09-14 20:54
在 Compass 看到 @mixin hide-text($direction) 的方法,默认情况不推荐使用负值的方式实现图片代替文本,这是为什么呢?
原文说明:
is more robust, especially in older browsers.
seems have better runtime performance.
为什么用
性能会更好呢?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| @mixin hide-text($direction: $hide-text-direction) {
@if $direction == left {
$approximate-em-value: 12px / 1em;
$wider-than-any-screen: -9999em;
text-indent: $wider-than-any-screen * $approximate-em-value;
overflow: hidden;
text-align: left;
}
@else {
// slightly wider than the box prevents issues with inline-block elements
text-indent: 110%;
white-space: nowrap;
overflow: hidden;
}
@include for-legacy-browsers((ie: "7"), $critical-usage-threshold) {
//Text transform capitalize fixes text-replacement issue when used in a |