为什么输入元素的大小,如果它们是内联元素? [英] Why can input elements be sized if they are inline elements?

查看:97
本文介绍了为什么输入元素的大小,如果它们是内联元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的印象是,内联元素不能调整其高度,但我可以使用< input type =text/> 元素。



我要更正< input type =text/> 元素是内联吗? / p>

如果是这样,它们与< span>< / span> 不能调整大小。

解决方案

input 元素 inline-阻止默认情况下不是 inline



另一方面,作为 span ,默认为 inline



元素的<$ c> width / height ,例如 输入 可以 (示例) 进行更改。



inline 元素,例如 span 默认情况下,其尺寸由其中的呈现内容定义。 (示例)


此[width]属性不适用于未替换的内联元素。未替换的内嵌元素框的内容宽度是其中的呈现内容(在儿童的任何相对偏移之前)的内容宽度。回想一下,内联框流入行框。线框的宽度由它们的包含块给出,但是可能由于浮动的存在而被短路。 - W3参考



I was under the impression that inline elements could not have their heights resized, but I am able to do so with <input type="text"/> elements.

Am I correct that <input type="text"/> elements are inline?

If so, what makes them different from <span></span> elements in how they can or cannot be resized.

解决方案

An input element is inline-block by default, not inline.

On the other hand, an element such as a span, is inline by default.

The width/height of an inline-block element, such as input can be changed (example).

While an inline element, for instance, span, cannot be changed by default, as its dimensions are defined by the "rendered content within them". (example).

This [width] property does not apply to non-replaced inline elements. The content width of a non-replaced inline element's boxes is that of the rendered content within them (before any relative offset of children). Recall that inline boxes flow into line boxes. The width of line boxes is given by the their containing block, but may be shorted by the presence of floats. - W3 reference

这篇关于为什么输入元素的大小,如果它们是内联元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆