Jquery mobile 在jquerymobile中,建议使用什么方法来设置标签和值的样式?

Jquery mobile 在jquerymobile中,建议使用什么方法来设置标签和值的样式?,jquery-mobile,Jquery Mobile,我熟悉使用label for=my_id和输入类型标记设置表单样式。我真的很喜欢如果表单宽度减小到较窄的宽度,它会自动设置表单组件的样式,并且我喜欢输入标记左对齐 我想做相同类型的样式,除了现在我想显示一个记录,其中标签和它们的值的样式是相似的 这里有一些代码,我希望可以工作,但它没有 <div data-role="fieldcontain"> <label for="full_name"><strong>Name:</strong>&l

我熟悉使用label for=my_id和输入类型标记设置表单样式。我真的很喜欢如果表单宽度减小到较窄的宽度,它会自动设置表单组件的样式,并且我喜欢输入标记左对齐

我想做相同类型的样式,除了现在我想显示一个记录,其中标签和它们的值的样式是相似的

这里有一些代码,我希望可以工作,但它没有

<div data-role="fieldcontain">
    <label for="full_name"><strong>Name:</strong></label>
    <span id="full_name">John Smith</span>
</div>
<div data-role="fieldcontain">
    <label for="phone"><strong>Long Phone Label:</strong></label>
    <span id="phone">(800) 555-1212/span>
</div>

有没有关于不借助表格就能做到这一点的正确方法的想法?

也许这会奏效。您可以使用JQM网格进行并排标记:

It seems that you want to align the text in the way the form is aligned.The below code will align the labels with their values.This is what i understand from your question.i hope the below code will help you.

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="jquery.mobile-1.0rc1.css" />
<script type="text/javascript" src="js/Common/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/Common/jquery.mobile-1.0rc1.js"></script>

<style>
#b {
    left: 156px;
    bottom: 50px;
}

</style>
</head>
<body>
<div data-role="page" id="header">
    <div data-role="fieldcontain" id="a">
    <label for="full_name"><strong>Name:</strong></label><br>
    <label for="phone"><strong>Long Phone Label:</strong></label>
</div>
<div data-role="fieldcontain" id="b">
    <span id="full_name">John Smith</span><br>
    <span id="phone">(800) 555-1212</span>
</div>
</div>
</body>
</html>
标签:输入元素 标签:输入元素

但要小心,因为手机标签是故意这样做的。这样,您可以在进入Ihone等设备时看到标签和输入:

<div class="ui-grid-a">
<div class="ui-block-a"><strong>I'm Block A</strong> and text inside will wrap</div>
<div class="ui-block-b"><strong>I'm Block B</strong> and text inside will wrap</div>
</div>

我真的不明白你在问什么。什么会自动设置表单组件的样式?您指的是哪种类型的样式?样式类似于什么?我也怀疑你是否应该/能够使用这样的标签。属性的标签应该引用表单控件,而不是跨距。你为什么不能用桌子?这似乎是正确使用表的一个主要示例。感谢您的回复。你提供的解决方案不是我想要的。它在内容上方显示姓名和电话标签。我希望我的名字是:约翰·史密斯,然后在下一行上是长长的电话标签:800 555-1212。我希望这是有道理的。