2013-04-18 66 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省略号似乎不错,但我没有得到它的工作),请让我知道。