How to center a checkbox in a table cell?

后端 未结 10 1352
盖世英雄少女心
盖世英雄少女心 2020-12-05 03:57

The cell contains nothing but a checkbox. It is rather wide because of text in the table header row. How do I center the checkbox (with inline CSS in my HTML? (I know))

10条回答
  •  星月不相逢
    2020-12-05 04:07

    UPDATE

    How about this... http://jsfiddle.net/gSaPb/


    Check out my example on jsFiddle: http://jsfiddle.net/QzPGu/

    HTML

    checkbox

    CSS

    td {
      text-align: center; /* center checkbox horizontally */
      vertical-align: middle; /* center checkbox vertically */
    }
    table {
      border: 1px solid;
      width: 200px;
    }
    tr {
      height: 80px;   
    }
    

    I hope this helps.

提交回复
热议问题