search

Home  >  Q&A  >  body text

css3 transform 奇葩问题 ?

下面这段代码为什么在androud手机上有些浏览器下(包括微信)(所有.digit-col)的元素移动的距离却不一样!有多有少,甚是奇葩!

$(".digit-col").each(function(index, el) {
       $(el).attr("style","-webkit-transform: translate(0,20px);transform: translate(0,20px)");
});
PHP中文网PHP中文网2924 days ago493

reply all(4)I'll reply

  • 迷茫

    迷茫2017-04-17 11:56:22

    Because the set distance is px, different models have different resolutions. The unit pixel size is also different. If you change it to a percentage it should solve the problem

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:56:22

    Mobile phone resolution problem

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 11:56:22

    If you look at the use of rem units on the mobile terminal, the effect will be the same on different mobile phones

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 11:56:22

    Thank you for your replies. The problem has been solved because the background image of p only has a width set but not a height!
    There are still doubts here-"All p's have the same width and height. The background image only has a width but not a height. Why not?

    As a result, the position where the numbers stop after rotating is different (visually different), but in fact the transformation is the same!

    reply
    0
  • Cancelreply