我在容器中有两个元素:
@H_502_5@
风格如下:
@H_502_5@span,button {
display: block;
padding: 4px;
border: 1px solid black;
margin: 5px;
background: #c0c0c0;
font: inherit;
}
.container {
border: 1px solid black;
}
你可以看到现场演示here.
为什么按钮的宽度与跨度不同?如何使按钮的行为类似于标准块级元素?
我需要使用< button>这里是因为它的目的是提交表格.
最佳答案
I’m expecting there to be some ruleset that makes them both
behave like s
没有.原因是按钮是“replaced element”.
我能找到的最清楚的来源是:http://reference.sitepoint.com/css/replacedelements
A replaced element is any element whose appearance and dimensions are
defined by an external resource. Examples include images (
tags),
plugins (
Replaced elements can also have visual formatting requirements imposed
by the element,outside of the control of CSS; for example,the user
interface controls rendered for form elements.