< div>之间的间距和< table> [英] Spacing between <div> and <table>

查看:182
本文介绍了< div>之间的间距和< table>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有以下标记。问题是浏览器,例如IE6,

在< div>之间插入几行空格。以及

表。有没有办法减少垂直间距?

谢谢,CMA

< div class =" vlgray">条件< / div>

< table cellpadding =" 0" cellspacing =" 0">


< tr> < td width =" 696">& nbsp;


< ul>


< li>重点此系列将在最佳条件下展示


精湛的设计物品




挑剔的收藏家。请注意,即使


项目标记为& quot; mint,& quot;它仍然是旧的,因此,
比新产品更脆弱。< / li>


< li>< ; b>< i>优秀的条件并不意味着


mint< / i>< / b>。如果一件商品已被使用,那么它通常会是b
$ b至少有一些微妙的磨损迹象。期待一件复古服装是不现实和不合理的




具有与新衣服。< / li>


< li>古董/复古纺织品收藏家和


服装通常愿意与


的一些轻微的

缺陷,以获得现代质量无法提供的品质


生产的商品,如作为精致的手工和丰富,



loomed面料。& nbsp;< / li>


< li>每个项目的条件在


列表中描述。& nbsp;< / li>


< li>所有复古服装需要小心处理


。 < b>< i>可穿戴条件< / i>< / b>意味着


& quot;温柔的穿着& quot; - 请不要查询查尔斯顿




串珠连衣裙。< / li> < / UL> < p为H.;< / TD> < / tr>

< / table>


这是vlgray的造型。


..vlgray {font-size:large; font-weight:bold;背景:#CCC;宽度:

100%;


padding-left:1em; }

解决方案

CMAR写道:

我有以下标记。问题是浏览器,例如,IE6,在< div>之间插入几行空格。和
下表。


这很奇怪;在大多数浏览器中,< div>默认情况下没有边距,并且

< table>边距适中。

有没有办法最小化垂直间距?

< div class =" vlgray">条件< / div>
< table cellpadding =" 0" cellspacing =" 0">




table {margin-top:0;}


如果没有''工作,然后我们需要一个网址,看看出了什么问题。


-

Brian(删除.invalid给我发电子邮件)
http://www.tsmchughs.com/


" CMAR" <厘米*** @ yahoo.com>写道:

我有以下标记。问题是浏览器,例如,IE6,
在< div>之间插入几行空格。和
下表。


不,它是桌子内的间距。如果您在< table>中添加border =" 1"

,就可以看到这一点。标签,用于测试。

< tr> < td width =" 696">& nbsp;

< ul>




为什么使用& nbsp ;那里?这是一个不间断的空间,单独创建一个

的行,所以在实践中你有一个空白行。


那里''更多。 A< ul>在大多数
浏览器中,元素通常具有默认的上边距,但如果< ul>浏览器,浏览器可能会抑制此边距。元素在表格单元格的开头是
。现在它还没有开始 - 它之前有& nbsp;

的东西 - 所以你在IE6上得到的是一个空行后跟

a< ul> element的默认上边距。只需删除& nbsp;删除

垂直间距。


另一方面,您使用的是单格桌子,仅供参考

将最大列宽设置为696像素。因此,如果你在CSS中做这些事情,标记可以简化为b $ b。然而,桌面技巧

实际上在当今的浏览器上效果更好,特别是因为IE 6确实不支持max-width属性。

-

Yucca, http ://www.cs.tut.fi/~jkorpela/


" Jukka K. Korpela" < JK ****** @ cs.tut.fi>写道:

另一方面,您使用单格单元表的唯一目的是将最大列宽设置为696像素。因此,如果您在CSS中执行此类操作,则可以简化标记。但是,桌面技巧
在现今的浏览器中实际上效果更好,特别是因为IE 6不支持max-width属性。




黑客可用:
http://www.svendtofte.com/ code / max_width_in_ie /

-

Spartanicus



I have the following markup. The problem is that the browser, e.g., IE6,
inserts several lines of blank space between the <div> and the following
table. Is there a way to minimize that vertical spacing?
Thanks, CMA
<div class="vlgray">Condition</div>
<table cellpadding="0" cellspacing="0">

<tr> <td width="696">&nbsp;

<ul>

<li>The focus of this collection is to present

items of superb design in the best possible condition
for

the discerning collector. Please note that even when the

item is marked &quot;mint,&quot; it is still old and,

therefore, is more fragile than a new item.</li>

<li><b><i>Excellent condition does not mean

mint</i></b>. If an item has been used, it will
generally

have at least some subtle signs of wear. It is both

unrealistic and unreasonable to expect a vintage garment
to

have the same durability as a new garment.</li>

<li>Collectors of antique/vintage textiles and

clothing are often willing to live with a few minor
flaws in

order to have qualities not available in modern mass

produced goods, such as exquisite hand work and rich,
hand

loomed fabrics.&nbsp;</li>

<li>The condition of each item is described in

the listing.&nbsp;</li>

<li>All vintage garments need to be treated

with care. <b><i>Wearable condition</i></b> means

&quot;gentle wear&quot; - please don''t do the Charleston
in

a beaded dress.</li> </ul> <p></td> </tr>
</table>

Here is the styling of "vlgray".

..vlgray { font-size: larger; font-weight: bold; background: #CCC; width:
100%;

padding-left: 1em; }

解决方案

CMAR wrote:

I have the following markup. The problem is that the browser, e.g.,
IE6, inserts several lines of blank space between the <div> and the
following table.
That''s odd; in most browsers, <div> has no margins by default, and
<table> has modest margins.
Is there a way to minimize that vertical spacing?

<div class="vlgray">Condition</div>
<table cellpadding="0" cellspacing="0">



table {margin-top: 0;}

If that doesn''t work, then we need a url to see what is going wrong.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/


"CMAR" <cm***@yahoo.com> wrote:

I have the following markup. The problem is that the browser, e.g.,
IE6,
inserts several lines of blank space between the <div> and the
following table.
No, it''s spacing inside the table. You can see this if you add border="1"
into the <table> tag, for testing.
<tr> <td width="696">&nbsp;

<ul>



Why do you use &nbsp; there? It''s a no-break space, creating a line with
that alone, so there you have a blank line, in practice.

There''s more. A <ul> element normally has default top margin in most
browsers, but browsers may suppress this margin if the <ul> element is at
the start of a table cell. Now it''s not at the start - there''s the &nbsp;
stuff before it - so what you get on IE6 is a blank line followed by
a <ul> element''s default top margin. Just removing &nbsp; removes the
vertical spacing.

On the other hand, you are using a single-cell table for the sole purpose
of setting the maximal column width to 696 pixels. The markup could thus
be simplified if you do such things in CSS. However, the table trick
actually works better on present-day browsers, especially since IE 6 does
not support the max-width property.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


"Jukka K. Korpela" <jk******@cs.tut.fi> wrote:

On the other hand, you are using a single-cell table for the sole purpose
of setting the maximal column width to 696 pixels. The markup could thus
be simplified if you do such things in CSS. However, the table trick
actually works better on present-day browsers, especially since IE 6 does
not support the max-width property.



Hack available though:
http://www.svendtofte.com/code/max_width_in_ie/

--
Spartanicus


这篇关于&lt; div&gt;之间的间距和&lt; table&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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