Search code examples
htmlcssradio-buttonlabelcss-float

Just change float of a radio and label element


I wanna to change floats, You can see it (http://codepen.io/anon/pen/uqCts)

Now the label is in the right and radio button is in left, I wanna to chage it.. How can i do that?

Thanks ;)


Solution

  • try with this sample code:

    input[type=radio].css-checkbox {
       display:none;
    }
    
    input[type=radio].css-checkbox + label.css-label {
      padding-right:17px;
      height:12px; 
      display:inline-block;
      line-height:12px;
      background-repeat:no-repeat;
      background-position: right 0;
      color:#9a9a9a;
      vertical-align:middle;
      cursor:pointer;
    }
    input[type=radio].css-checkbox:checked + label.css-label {
      background-position: right -12px;
    }
    label.css-label {
      background-image:url(http://upcity.ir/images2/00476056564652779386.png);
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      -khtml-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
    }
    

    You have to change the padding-left for padding-right of your input[type=radio].css-checkbox + label.css-label and play with the background position.