Does anybody have idea why <legend>
tag is not centering in the JQuery mobile ? For example I tried following code.
<fieldset data-role="controlgroup" data-type="horizontal" data-theme="a">
<legend>I would this site.<legend>
<input type="radio" name="radio-choice-2-6" id="radio-choice-1-6" value="choice-1-6" />
<label for="radio-choice-1-6">1</label>
<input type="radio" name="radio-choice-2-6" id="radio-choice-2-6" value="choice-2-6" />
<label for="radio-choice-2-6">2</label>
<input type="radio" name="radio-choice-2-6" id="radio-choice-3-6" value="choice-3-6" />
<label for="radio-choice-3-6">3</label>
<input type="radio" name="radio-choice-2-6" id="radio-choice-4-6" value="choice-4-6" />
<label for="radio-choice-4-6">4</label>
<input type="radio" name="radio-choice-2-6" id="radio-choice-5-6" value="choice-5-6" />
<label for="radio-choice-5-6">5</label>
</fieldset>
When I check on the mobile and simulators the <legend>
tag hold text is aligned left even though I apply the style text-align: center
for the <legend>
tag. However if I put a longer text then it's works fine. eg:
<fieldset data-role="controlgroup" data-type="horizontal" data-theme="a">
<legend><p>If given the choice, I would rather spend time with my family than with friends or working.</p><legend>
<input type="radio" name="radio-choice-2-8" id="radio-choice-1-8" value="choice-1-8" />
<label for="radio-choice-1-8">1</label>
<input type="radio" name="radio-choice-2-8" id="radio-choice-2-8" value="choice-2-8" />
<label for="radio-choice-2-8">2</label>
<input type="radio" name="radio-choice-2-8" id="radio-choice-3-8" value="choice-3-8" />
<label for="radio-choice-3-8">3</label>
<input type="radio" name="radio-choice-2-8" id="radio-choice-4-8" value="choice-4-8" />
<label for="radio-choice-4-8">4</label>
<input type="radio" name="radio-choice-2-8" id="radio-choice-5-8" value="choice-5-8" />
<label for="radio-choice-5-8">5</label>
</fieldset>
Could any please shout with an answer ?
That is because in your first example legend no longer exist after jQuery Mobile restyled the page.
Instead of legend tag like this:
New structure look like this:
Or if you want a full look, your new HTML (after jQM restyling) looks like this:
Now you can use additional css to change this, like in this example: http://jsfiddle.net/Gajotres/YBSDb/