2013-03-25 94 views
1

我正在使用Jquery mobile 1.3。我有一個輸入,Jquery Mobile 1.3和輸入大小問題?

 <input style="width: 75px" type="text" /> 

問題是它的大小總是很大。如何使它小,

http://jsfiddle.net/2bWfL/163/

<head> 
    <title>My Page</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" /> 
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> 
</head> 
<body> 

<div data-role="page"> 

    <div data-role="header"> 
     <h1>My Title</h1> 
    </div><!-- /header --> 

    <div data-role="content">  

     <input type="text" style="width:75px"/> 
    </div><!-- /content --> 

</div><!-- /page --> 

</body> 
+0

?那是你想要的嗎?\ – 2013-03-25 08:40:20

回答

6

的JQuery Mobile擁有其所有控件的默認大小(以百分比計),並且還JQM代替我們有自己生成的標籤寫html標籤(通常跨度),所以爲了改變文本框的寬度,將下面的代碼添加到頁面的頭部。

<style type="text/css"> 
.ui-input-text 
{ 
width: 75px !important; 
} 
</style> 

由於JQM控制自行調整至屏幕的尺寸,它建議使用百分比,而不是「像素」值或「時間的。

+1

就是這樣,謝謝 – user960567 2013-03-25 09:21:06

1

如果你想爲同一頁面上的文本輸入不同的尺寸,然後從CSS中刪除width屬性這樣

div .ui-input-text { padding: 0 .4em; } 

那麼你的HTML頁面上,無論你定義你輸入的文字把它定義爲如下

<div style="width:30px"><input type="text" placeholder="01"> 

因此,在你的div標籤中定義你想要的寬度,你將能夠給不同的文本輸入不同的寬度。 希望這個答案可以幫助非設計師的人喜歡我

感謝

要減少文本框的大小