HTML inputs in Blackberry have different width depending on their type

∥☆過路亽.° 提交于 2019-12-13 02:05:20

问题


Inputs with styles width: 100%; box-sizing: border-box; of type number or date have a different width than the ones of type text when I test the following code in Blackberry. I have checked it for simulators 9380, 9810 and 9850 and in 9810 device.

<style type="text/css">
    #inputsTest { 
        border: 1px solid red; 
        margin: 15px; 
    }

    #inputsTest input { 
        border: 1px solid green; 
        width: 100%; 
        -webkit-box-sizing: border-box; 
        -moz-box-sizing: border-box; 
        box-sizing: border-box; 
    }
</style>

<div id="inputsTest">
      <label for="test1">Text</label>
      <input id="test1" type="text"/>
      <label for="test2">Number</label>
      <input id="test2" type="number"/>
      <label for="test3">Date</label>
      <input id="test3" type="date"/>
</div>

This is a screen capture from Firefox:

And this is how it looks in Blackberry (the width difference is visible in the red circles):

Code is also available here: http://jsfiddle.net/GXfXG/5/


回答1:


I have solved this issue adding this CSS, thanks to this answer and this:

input[type=number]::-webkit-outer-spin-button,
input[type=date]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


来源:https://stackoverflow.com/questions/13453834/html-inputs-in-blackberry-have-different-width-depending-on-their-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!