Aligning Checkbox with Label


/ Published in: CSS
Save to your folder(s)

Aligning a label with a checkbox can be tricky. Here is the HTML and CSS I used to achieve it.


Copy this code and paste it in your HTML
  1. <!-- The HTML -->
  2. <div class="checkbox-label"><input type="checkbox" /><span>Remember me</span></div>
  3.  
  4. // The CSS
  5. .checkbox-label {
  6. display: inline;
  7. font-size: 12px;
  8. padding-left: 5px;
  9. }
  10.  
  11. .checkbox-label span {
  12. padding-left: 5px;
  13. padding-bottom: 15px;
  14. vertical-align: bottom;
  15. line-height: 22px;
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.