HTML – 如何防止缩小内容的大小?

前端之家收集整理的这篇文章主要介绍了HTML – 如何防止缩小内容的大小?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在容器中有两个元素:

@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 ( tags),and form elements (,,
,and tags). All other elements types can be referred
to as non-replaced elements.

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.

猜你在找的HTML相关文章