2013-08-20 29 views
0

我试图居中占位符文本。它看起来集中在IOS上,但仍然左对齐在Android 4上。Sencha Touch 2:输入占位符未在Android中居中4

/*css code is below*/ 
    #myinput input{ 
     text-align:center!important; 
    } 
    #myinput input::-webkit-input-placeholder{ 
     text-align:center!important; 
    } 


//the view (.js file) has 
{ 
    xtype: 'emailfield', 
    name: 'myinput', 
    id: 'myinput', 
    required: true, 
    placeHolder: 'myinput (optional)', 
    listeners: { 
     //some listeners are here 
    } 
} 

我在想什么?

回答

3

Android有一个bug在这里:(居中不起作用你可以使用这个polyfill:https://github.com/diy/jquery-placeholder它支持“force”属性,该属性使得它甚至在浏览器上运行“支持”占位符,就像机器人。

$('#myInput').placeholder({force:true}); 

然后使用普通的CSS样式由插件提供的占位符类

.placeholder{ 
    text-align: center; 
} 
0

标准的方式来写,这是如下:

#myinput::-webkit-input-placeholder{ 
     text-align:center!important; 
} 

否 “输入” #myinput后,试试吧!