我在这里缺少什么?
编辑,因为这在注释中不起作用:
以下解决方案导致:
---------------------------------------------------- | | | Legend text |
但我要做的是:
----------------------Legend text------------------- | | | |
编辑#2:
根据迄今为止的反馈,这听起来像这个整体< legend>标签是一个失败的命题.有人有一个例子,他们用什么代替这个 – 有类似外观更可靠的东西?
解决方法
假设你的标记看起来像这样:
<form> <fieldset> <legend>Person:</legend> Name: <input type="text" size="30" /><br /> Email: <input type="text" size="30" /><br /> Date of birth: <input type="text" size="10" /> </fieldset> </form>
你的CSS应该是这样的:
legend { margin:0 auto; }
这最简单
哦,亲爱的…当涉及到浏览器的兼容性时,你可能已经选择了CSS中最困难的事情.卡梅伦·亚当斯表示最好
Probably the only difficulty in
styling semantic forms is the legend
tag. It is insufferably variable
across browsers. In Mozilla,the
legend tag is not left-indented from
the body of the fieldset,in IE and
Opera it is. In Mozilla,the legend
tag is positioned in between the
fieldset’s border and its content,in
IE and Opera it is positioned inside
the content. This makes it very hard
to move the legend inside the fieldset
border,or position it flush to the
left of the fieldset,as you get
varying effects across browsers
您可以阅读更多关于他在Fancy Form Design Using CSS上如何表达风格的内容.