gpt4 book ai didi

html - 使用 JQuery Mobile 强制两个元素在同一行中彼此相邻的任何方法?

转载 作者:搜寻专家 更新时间:2023-10-31 08:03:34 25 4
gpt4 key购买 nike

我想让两个元素保持在同一行。

现在我有这段代码:

<fieldset data-role="controlgroup" data-type="horizontal">
<label for="textinput">Text:</label>
<input type="text" id="textinput"/>
<input type="button" id="searchbutton" data-icon="search" data-iconpos="notext" onclick="function()"/>
</fieldset>

这行得通。只要您在计算机浏览器中全屏查看,标签、输入字段和按钮都将位于同一行。但是如果我们缩小窗口,所有三个元素将分别显示在一行中。有什么办法可以让标 checkout 现在一行,输入框+按钮在下一行?

最佳答案

您需要覆盖 jQM 增强功能:

JS

$('#textinput2').css('width','60%').css('display','inline');

HTML

<div>
<!-- use span instead of label -->
<span>Text:</span>
<input type="text" id="textinput2"/>
<br />
<input type="button" id="searchbutton2" data-icon="search" data-iconpos="notext" onclick="function()"/>
</div>

我想你可能想看看 jQM 提供的网格布局

关于html - 使用 JQuery Mobile 强制两个元素在同一行中彼此相邻的任何方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7709994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com