HTML inputs in Blackberry have different width depending on their type
Asked Answered
M

1

1

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: enter image description here

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

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

Miguelinamiguelita answered 19/11, 2012 at 12:28 Comment(2)
There might be default right-padding in the BB CSS. Try setting the padding to zero.Housekeeping
I already tried that. The inputs become a little wider with padding-left: 0px; padding-right: 0px but still sorter than the input of type="text"Miguelinamiguelita
M
2

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;
}
Miguelinamiguelita answered 20/11, 2012 at 14:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.