鍍金池/ 問答/HTML5  Unity 3D  HTML/ css3 transform描邊問題 如圖

css3 transform描邊問題 如圖

圖片描述

圖片描述

圖1是正常的描邊,在手機上顯示很粗,于是我用了transform: scale(0.5),變成圖2的效果了,在PC上是好的,在手機上看線的上面和下面多了一點距離,在網(wǎng)上查了一下,別人說用overflow: hidden;,用了還是不行

.nav_left .nav_left_item:after {
    content: '';
    height: 1px;
    width: 200%;
    position: absolute;
    left: 0px;
    top: auto;
    right: auto;
    bottom: 0px;
    background-color: #e5e5e5;
    border: 0px solid transparent;
    border-radius: 0px;
    -webkit-border-radius: 0px;
    transform: scale(0.5);
    -webkit-transform: scale(0.5);
    -moz-transform: scale(0.5);
    -ms-transform: scale(0.5);
    -o-transform: scale(0.5);
    transform-origin: top left;
    -webkit-transform-origin: top left;
    -moz-transform-origin: top left;
    -ms-transform-origin: top left;
    -o-transform-origin: top left;
    overflow: hidden;
}

.nav_left_item.active  {
  color:#00b38a;
  background: #f2f2f2;
  position: relative;
}
.nav_left_item.active:before {
    content: " ";
    position: absolute;
    top: 0;
    left: 0;
    display: inline-block;
    width: 2px;
    height: 100%;
    background: #00b38a;    
}
回答
編輯回答
別逞強

關于這個的話我有兩個想法:
1、把描邊使用圖片來代替,這樣兼容性還很好;
2、使用媒體查詢,在手機上的時候把下面的每個盒子往上移動一點兒,剛好把那個白邊給它蓋住。

2017年3月20日 10:46
編輯回答
陪她鬧

只有css代碼不太好調試,而且感覺寫法很奇怪。如果改成

height:1px->height:0.5px;/*不用scale*/
bottom:0px->bottom:0

效果有變化嗎?

2017年6月8日 00:42
編輯回答
淺淺

因為transform的屬性不改變布局,占據(jù)的空間還是原來占據(jù)的空間那么大

2018年6月21日 19:19
編輯回答
傲寒

手機上不用寫那么多動畫屬性 只需要些 -webkit- 和 默認的 就好了

2017年12月21日 16:45
編輯回答
遲月

要使用transform-origin設置基點位置。
因為你這樣縮小可是他的實際占位海是1px
看圖更清楚
clipboard.png

2018年4月2日 06:35