2013-04-18 39 views
1

我的代碼的HTML文本標記如上述如下運行到下一行上移動

<div data-role="content" id="div1" align="top" style="padding:3 !important;" > 
     <table border="0" align="CENTER" cellspacing="0" width="100%" style="vertical- align: text-bottom;" > 
     <tr> 
     <td></td> 
     <td> 
      <div id="question1" class="question"> 
       <input type="text" id="question" /> 
      <Style> 
       #question{ 
        font:5px; 
        font-family:verdana; 
       } 
      </style>   
      </div> 
     </td></tr><tr> 
     <td width="50"><img id="img2" width="40" height="36" style="float:right; margin-top: 0px;" ></td> 
     <td style="text-align:center;"> 
      <div class="ui-grid-b" > 
       <div class="ui-block-a"><button id="button1" type="submit" data-theme="b" style="font-size:0.8em;"></button></div> 
       <div class="ui-block-b"><button id="button2" type="submit" data-theme="b" style="font-size:0.8em;"></button></div> 
       <div class="ui-block-c"><button id="button3" type="submit" data-theme="b" style="font-size:0.8em;"></button></div> 
      </div> 
     </td> 
     </tr> 
     </table> 
</div> 

在代碼的塊,在下面的代碼行

<input type="text" id="question" /> 

,如果值是填充通過jQuery的,我做的是

$('.question').text(questionText); 

,當我在我的iPhone查看此,文雲到下一行,當它再牛逼寬度。我認爲textarea是唯一具有多行的HTML標籤。不知道爲什麼這裏的文字是多行的,我如何避免它?我不介意文本被切斷,但我真的不希望它多行。

回答

0

嘗試應用overflow: auto輸入字段

<style type="text/css"> 
    input[type=text] { overflow: auto; } 
</style> 

您可能需要設置輸入元素的高度,我不完全相信你想在這裏實現什麼。您可以設置overflow-x: auto如果你只希望它垂直滾動水平或overflow-y滾動

+0

溢出:自動不起作用。我試圖做溢出:隱藏,但似乎弄亂了用戶界面,使文本開始顯示在按鈕後面。 – p0tta 2013-04-19 04:20:28

0

所以我固定它現在是這樣的,我做了以下

<div id="question1" class="question" style="height: 12px;"> 
      <input type="text" id="question" /> 
     <Style> 
      #question{ 
       font:5px; 
       font-family:verdana; 
      } 
     </style>   
     </div> 

我ATLEAST得到了多線消失,但如果有更優雅的方式(jQuery省略號似乎不錯,但我沒有得到它的工作),請讓我知道。