如何将复选框和文本输入标记对齐到jquery-mobile行

Ala*_*ain 7 css fieldset jquery-mobile

使用JqueryMobile,我希望实现以下布局:

  1. 有漂亮的装饰盒来分隔我的输入线
  2. 将一个复选框与输入文本字段垂直对齐,两者都在同一行上

我需要实现的目标

但经过多次尝试,我唯一可以采用的布局如下: 我得到了什么

第一次尝试看起来很合适jquerymobile grids,但我checkbox不再可以选择并永远保持检查.第二次尝试使用的fieldset建议jquerymobile,但是,我松了checkbox,我尝试使用css float属性,但没有成功.

这是完整的代码:

  <!DOCTYPE html> 
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Multi-page template</title> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
</head> 
<body style="font-size: 12px;"> 
<div data-role="page" id="one">
    <div data-role="content">   
      <div class="ui-grid-a">
         <div class="ui-block-a" style="width: 20%;" >
            <div class="ui-bar ui-bar-e" style="height:24px; padding: .4em 4px;">
               <div class="ui-checkbox">
                  <label data-corners="true" data-shadow="false" data-iconshadow="true" data-wrapperels="span" data-icon="checkbox-off" class="ui-btn ui-btn-corner-all ui-btn-icon-left ui-checkbox-on">
                      <span class="ui-btn-inner ui-btn-corner-all">
                      <span class="ui-icon ui-icon-shadow ui-icon-checkbox-on"></span>
                      </span>
                  </label>
               </div>
            </div>  
         </div>
         <div class="ui-block-b" style="width: 80%;" >
            <div class="ui-bar ui-bar-e" style="height:24px">Block B</div>
         </div>
       </div>

       <div style="height: 200px;">
           <fieldset data-role="controlgroup" data-type="horizontal">
               <input type="checkbox" name="checkbox-mini-0" id="checkbox-mini-0"  class="custom" />
               <label for="checkbox-mini-0" >&nbsp</label>
               <input type="text" name="texta" id="texta" class="custom" style="width:36px;" />
           </fieldset>  
           <div style="height: 30px; border:1px solid lightgray;">
           </div>   
           <div style="height: 30px; border:1px solid lightgray;">
           </div>      
        </div>      
   </div>
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

任何帮助或评论,以实现我的目标将不胜感激?

在线编辑器:您也可以访问http://jsfiddle.net/alain_lavoie/XhsEh/上的html文件

小智 3

http://jsfiddle.net/XAsyy/110/

从 Nirmal Patel ans 更新,我发现文本区域可以与复选框一起使用,如果您不希望文本区域增长:

data-role="none" ie. <textarea id="test"  data-role="none"></textarea>
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/XAsyy/144/

或者,使用:

css resize: none;
Run Code Online (Sandbox Code Playgroud)