将两个输入文本放在同一行

Maz*_*zzy 7 html css jquery-mobile

我正在使用html和jquery mobile.here代码:

<div data-role = "content">
        <form action = "?" method="post" name="form" id = "form">
            <fieldset>
            <div data-role = "fieldcontain" class = "ui-hide-label">
                <label for="name">Name</label>
                <input type="text" name="name" id="name" value="" placeholder="Name" />
            </div>

            <div data-role ="fieldcontain" class= "ui-hide-label">
                <label for="surname">Surname</label>
                <input type="text" name="surname" id="surname" value="" placeholder="Surname"/>
            </div>

            <div data-role ="fieldcontain" class= "ui-hide-label">
                <label for="address">Address</label>
                <input type="text" name="address" id="address" value="" placeholder="Address"/>
            </div>


                <div data-role="fieldcontain" class="ui-hide-label">
                    <label for="birth-place">Birth Place</label>
                    <input type="text" name="birth-place" id="birth_place" value="" placeholder="Birth Place" />
                </div>
                <div data-role = "fieldcontain" class="ui-hide-label">
                    <label for="province">Province</label>
                    <input type="text" name="province" id="province" value="" placeholder="PR" />
                </div>


                <div data-role="fieldcontain" class="ui-hide-label">
                    <label for"date">Birth Date</label>
                    <input type="datetime" name="dt" id="dt" value="" placeholder="Birth Date" />
                </div>

                <div data-role="fieldcontain">
                    <fieldset data-role="controlgroup" data-type="horizontal">
                        <input type="radio" name="radio-choice-1" id="radio-choice-1" value="male" />
                        <label for="radio-choice-1">Male</label>
                        <input type="radio" name="radio-choice-1" id="radio-choice-2" value="female"  />
                        <label for="radio-choice-2">Female</label>
                    </fieldset>
                </div>

                <div data-role="fieldcontain" data-type="horizontal">
                    <label for="select-choice-0"></label>
                    <select name="select" id="select">
                        <option value="politrauma">Politrauma</option>
                        <option value="cardiologico">Cardiologico</option>
                        <option value="neurologico">Neurologico</option>
                    </select>
                </div>
            </fieldset>
        </form>
    </div>
Run Code Online (Sandbox Code Playgroud)

我无法在同一行输入两个输入文本.我试过块网格,但它没有用

Jor*_*est 7

您应该查看jquerymobile中的两个列布局: jquerymobile.com/demos/1.0.1/docs/content/content-grids.html

你的代码应该是这样的:

<form action = "./includes/user_form.php" method="post" id = "form">
    <div class="ui-grid-a">
            <div data-role = "fieldcontain" class = "ui-hide-label ui-block-a">
                <label for="name">Name</label>
                <input type="text" name="name" id="name" value="" placeholder="Name" />
            </div>
            <div data-role ="fieldcontain" class= "ui-hide-label ui-block-b">
                <label for="surname">Surname</label>
                <input type="text" name="surname" id="surname" value="" placeholder="Surname"/>
            </div>
    </div>
 </form>
Run Code Online (Sandbox Code Playgroud)


Ada*_*dan 5

我知道这个问题有点旧,但我遇到了同样的问题,这对我有用:

<fieldset class="ui-grid-a">
<div class="ui-block-a">
        <input type="text" id="" name="" value="">
</div>
<div class="ui-block-b">
        <input type="text" id="" name="" value="">
</div>
Run Code Online (Sandbox Code Playgroud)

您甚至可以添加一些样式来更改字段的相对大小.


Dio*_*ane 1

DIVs 是块元素 - 默认情况下它们占据 100% 宽度。这使得以下元素出现在“下一行”。

因此,您需要将第二组元素移动到与第一个元素相同的 DIV 中(或者使用固定宽度重新设置 DIV 样式并使用浮动,但这更具挑战性)