text in table cells not centered as in headers

前端 未结 2 738
盖世英雄少女心
盖世英雄少女心 2021-01-26 16:52

CSS:

.one {
    width: 13%;
}

.two {
    width: 30%;
}

.three {
    width: 30%;
}

HTML:

相关标签:
2条回答
  • 2021-01-26 17:14

    First of all you forgot to close the td after the first input.

     <td class = "one"><input type="text" name="quantity1" value=""/></td>
    

    You can add this css to make them center

    td
    {
        text-align:center;    
    }
    

    Have a look on this EXAMPLE

    0 讨论(0)
  • 2021-01-26 17:16

    You can add this to your css:

    td.two, td.three {
      text-align:right;
    }
    

    You need the td prefix cause your th is using the same css class.

    I hope that helps.

    0 讨论(0)
提交回复
热议问题