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

HTML– 如何防止缩小内容的大小?,第1张

概述我在容器中有两个元素:<div class='container'> <span>This is a div</span> <button>This is a button</button> </div> 风格如下:span, button { display:

我在容器中有两个元素:

风格如下:

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 – 如何防止缩小内容大小?全部内容,希望文章能够帮你解决HTML – 如何防止缩小内容的大小?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1120344.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)