Total Pageviews

2015/11/02

How to add more spaces between radio button and its text?

Problem
Our customer asked to add more spaces between radio button and its text

Original code snippet:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<div class="row">
  <div class="col-sm-12">
      <div class="col-sm-6 ">
          <label class="control-label label-width-4 text-right">預算階段</label> 
          <input type="radio" value="P0" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusP0">
                 {{budgetStatusP0Text}}
          <input type="radio" value="P1" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusP1">
                 {{budgetStatusP1Text}}
          <input type="radio" value="F0" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusF0">
                 {{budgetStatusF0Text}}
          <input type="radio" value="F1" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusF1">
                 {{budgetStatusF1Text}}
          <input type="radio" value="F2" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusF2">
                 {{budgetStatusF2Text}}
      </div>
      
      <div class="col-sm-6 ">
      </div>
  </div>
</div>  

How-To
Modify the margin value for each input radio element.
i.e. margin:0px 0px 0px 6px;

  • top margin is 0px
  • right margin is 0px
  • bottom margin is 0px
  • left margin is 6px

Check the following updated code snippet:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<div class="row">
  <div class="col-sm-12">
      <div class="col-sm-12 ">
          <label class="control-label label-width-4 text-right">預算階段</label> 
          <input type="radio" value="P0" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusP0"
                 style="margin: 0px 0px 0px 6px">
                 {{budgetStatusP0Text}}
          <input type="radio" value="P1" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusP1"
                 style="margin: 0px 0px 0px 6px">
                 {{budgetStatusP1Text}}
          <input type="radio" value="F0" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusF0"
                 style="margin: 0px 0px 0px 6px">
                 {{budgetStatusF0Text}}
          <input type="radio" value="F1" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusF1"
                 style="margin: 0px 0px 0px 6px">
                 {{budgetStatusF1Text}}
          <input type="radio" value="F2" 
                 data-ng-model="dbm003eFormBean.budgetStatus" 
                 data-ng-hide="hideBudgetStatusF2"
                 style="margin: 0px 0px 0px 6px">
                 {{budgetStatusF2Text}}
      </div>
  </div>
</div>

Check result:


Reference
[1] http://www.w3schools.com/cssref/pr_margin.asp

No comments: