css label width not taking effect

前端 未结 6 1034
青春惊慌失措
青春惊慌失措 2020-12-23 02:37

I have a generic form, which I\'d like to style to align the labels and the input fields. For some reason when I give a width to the label selector, nothing happens:

6条回答
  •  Happy的楠姐
    2020-12-23 03:03

    label's default display mode is inline, which means it automatically sizes itself to it's content. To set a width you'll need to set display:block and then do some faffing to get it positioned correctly (probably involving float)

提交回复
热议问题