CSS, how to create a label width of the longest containing text?

前端 未结 6 465
慢半拍i
慢半拍i 2021-02-02 15:29

I have a table with two columns, like this:

Firstname: Jeff

Where the first column is a label and the second one is an input. Now I\'m setting

6条回答
  •  情歌与酒
    2021-02-02 15:44

    simple solution would be to fix the length of the label which would accommodate the biggest lable (add some 50px extra so you can center it) and use text-align:center

    Here's a fiddle for the same.. http://jsfiddle.net/mvivekc/4P58S/

    hope it helps.

提交回复
热议问题