How do i center the heading in my form heading?

前端 未结 3 1046
时光取名叫无心
时光取名叫无心 2021-01-21 12:15

I am using the center tag to center a heading in my form, \"Please register your details\". It works perfectly like I want it to but it fails the validation. Does any one else

3条回答
  •  一向
    一向 (楼主)
    2021-01-21 12:42

    While the width of the label element by default is 100%, the display is still inline. Without using the block display AND specifying a width: margin:0 auto; will NOT work.

    The only correct use for this instance is:

    Please Register Your Details
    

    Setting a width for this would be unwise, as the physical font width can vary between browsers, and "over compensating" the width will result in offsetting the text from the center.

提交回复
热议问题