如何使用jquerymobile在一行中显示多个<input />

时间:2012-03-28 02:53:21

标签: jquery-mobile

我想用jquery mobile连续显示两个日期。但它只适用于桌面浏览器。在移动浏览器中将独立排列。

<div data-role="fieldcontain">
                <label for="time_start" class="ui-hidden-accessible">time_start:</label>
                <label for="time_end" class="ui-hidden-accessible">time_end:</label>
                <input type="date" name="time_start" value="2011-05-30" /> — <input type="date" name="time_end" value="2011-05-30"/>
</div>

3 个答案:

答案 0 :(得分:0)

您是否尝试过将标签和输入放入范围内?

答案 1 :(得分:0)

浮动:左边和宽度:80(例如)应该为你做的伎俩。以下是小按钮和大按钮的示例。

http://jsfiddle.net/den232/SN85d/

祝你好运!

.floatleft {
    float:left;
 }
.floatright {
    float:right;
 }
.forceinline{  /* Prevent fieldcontain from doing a BLOCK thing */
    display:inline !important;
}
.textwidth {  /* limit width of input fields */
    width:80px;
}
.closespacing { /* controls spacing between elements */
    margin:0px 5px 0px 0px;
 }
.bigselect {   /* centers select with big buttons */
    padding: 0px;
    margin:2px 5px 0px 0px;
 }
.biginputheight {   /* matches text input height to big buttons */
    padding-top:10px !important;
    padding-bottom:12px !important;
}
.miniinputheight { /* matches text input height to minibuttons */
    padding-top:5px !important;
    padding-bottom:5px !important;
}
<div data-role="page" class="type-home">

<ul data-role="listview">
  <li  data-role="fieldcontain">first LI line</li>
  <li  data-role="fieldcontain">

    <div class='floatleft closespacing'>
        Big Buttons<br>More Text
    </div>

    <div  class='floatleft textwidth'>
      <input type="date" placeholder="#1" class='biginputheight'></input>
    </div>  

    <div  class='floatleft textwidth'>
      <input type="date" placeholder="#2" class='biginputheight'></input>
    </div>  


  </li>
  <li  data-role="fieldcontain">

    <div class='floatleft closespacing'>    
        Small Buttons
    </div>

     <div  class='floatleft textwidth'>
      <input type="date" placeholder="s1" class='miniinputheight'></input>
    </div>  

    <div  class='floatleft textwidth'>
      <input type="date" placeholder="s2" class='miniinputheight'></input>
    </div>  

   </li>
  <li  data-role="fieldcontain">last LI line</li>

</ul><!-- /listview -->  

答案 2 :(得分:-1)

也许你可以使用网格来实现它

<div class="ui-grid-a">               
    <div class="ui-block-a"><label for="time_end" class="ui-hidden-accessible">
      time_end:    </label>  
    <div class="ui-block-b"><label for="time_end" class="ui-hidden-accessible">
      time_end:    </label>                 
</div>