Center Radio buttons

Description

The following code shows how to center Radio buttons.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type="text/javascript"
  src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.css">
<style type='text/css'>
.ui-btn.activeOnce {<!-- w ww .jav a2  s.c o m-->
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.centerRadio {
  width: 80%;
  margin: 0 auto;
}
</style>
</head>
<body>
  <fieldset data-role="controlgroup" data-type="vertical"
    style="text-align: center">
    <div class="centerRadio">
      <input type="radio" name="radio-choice-1" id="radio-choice-1"
        value="choice-1" checked="checked" /> 
      <label for="radio-choice-1">A</label>
      <input data-theme="e" type="radio" name="radio-choice-1"
        id="radio-choice-2" value="choice-2" /> 
      <label for="radio-choice-2">B</label>
    </div>
  </fieldset>
  <a href="" data-role="button" id="buton" class="activeOnce">Button</a>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme