为什么我的宽度在100%? [英] Why is my width at 100%?
问题描述
如果你去这个网站,你会看到$(#coreimage)设置为width:auto。
If you go this site, you'll see that $("#coreimage") is set to width:auto.
但是,由于某些原因,它不保持cheerios框的宽度(而是100%...)
However, for some reason, it doesn't maintain the width of the cheerios box (Instead, it's 100%...)
推荐答案
coreimage
是一个 div
,它是一个块元素。除非您显式设置宽度( auto
以外的值)或 float ,块元素默认采用完整的可用宽度, code>元素。
coreimage
is a div
, which is a block element. Block elements, by default, take the full available width, unless you explicitly set the width (to a value other than auto
), or float
the element.
我不知道你想要的结果是什么,但你可以将元素更改为内联元素 span
)或在您的元素上指定 float:left
。
I'm not sure what you want the end result to be, but you can either change the element to an inline element (i.e. span
) or specify float: left
on your element.
这篇关于为什么我的宽度在100%?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!