English 中文(简体)
IE占用空间空洞
原标题:empty span in IE occupies space

在视察精英时,我注意到以下空洞的距离:

<span class="x-tree-node-indent"></span>

为了不占用任何空间,我行文如下:

span.x-tree-node-indent
{
    left:0px;
    width:0px;
    height:0px;
    margin:0px;
    padding:0px;
}

在 Chrome,我甚至没有外表风格。 但是,在独立实体中,我仍然能够看到一片空间。 任何原因? 如何确定这一点?

问题回答

我曾经历过你在IE6、7和8中重新描述的情况。

您还必须将<>光线-八至0>。 这通常适用于线性元素。

您是否尝试了<代码>:无<>/代码>?

span.x-tree-node-indent {
    display: none;
}

That should work the same everywhere but I can t check IE right now, display:none:

这种价值导致在格式结构中不出现一个因素(即,在视觉媒体中,该元素不会产生任何箱子,也不会对布局产生影响)。 原始元素不会产生任何箱子;元素和的内容从完全的格式结构中删除。 这种行为不能因为将展示财产放在后代身上而遭到践踏。

Please note that a display of none does not create an invisible box; it creates no box at all. [...]

Emphasis mine.

Here s a quick example if you want to check for yourself: http://jsfiddle.net/ambiguous/ZrzWz/

如前所述,显示:不会使该项目完全摆脱布局。 可见度:不隐秘;也就是说,如果你有20px,那么即使空间被隐藏,空间的封块仍将继续占据。

你们也可以把展示放风、通向无外空和白天。

其他几个项目将有助于了解——为了让任何人以多于显示的方式回答这一问题:没有(如果你们想要做的是从空间中拿走的话,那将做任何工作)。

  1. What version of IE are you referencing? In no way are the all the same.
  2. What is the purpose of the span, if in fact you do not want it to be visible?
  3. What doctype is your HTML? Depending, for IE there could be quirks mode involved, you may have the option of using an IE specific meta tag, telling it to render in IE7 mode etc.

对于第2号,如果你只是想像名称所暗示的那样具有一定性,那么你就可以使用CSS文本:10px(或不管怎样)。 如果你有其他原因,就有一些选择,例如,在含水区设置间隙、dding。 换言之,奇怪的是,为什么在缺乏可见度的情况下,这种情况会发生? 从而导致你尝试其他要素等。

I can t reproduce it here. Here is my code:

span.x-tree-node-indent
{    
    left: 0px;    
    width: 0px;    
    height: 0px;    
    margin: 0px;    
    padding: 0px;
}

<BODY>
<P>left<SPAN class="x-tree-node-indent"></SPAN>right</P>
</BODY>

I see the one word "leftright" without any space inbetween in my IE9.

视您想要达到何种行为而定,您可使用<条码>:无和<条码> 可使用:hidden/条码>。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签