CSS垂直间距 - 无法让它消失

发布于 2024-10-24 04:54:34 字数 471 浏览 2 评论 0原文

尝试消除下一页上“td”标签之间的垂直空间:

http://framework.matthewruddy.com/2008/09/04/layout-test/3/

我怎样才能让它消失?我无法弄清楚。奇怪的是,在 IE 中根本没有发生这种情况。

尝试了以下 CSS 以及重置 CSS。 <代码>

table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}
table td {
    margin: 0;
    padding: 0;
}

Trying to get rid of the vertical space between the 'td' tags on the following page:

http://framework.matthewruddy.com/2008/09/04/layout-test/3/

How can I make it go away? I cannot figure it out. It isn't happening in IE at all, oddly.

Tried the following CSS, along with a reset CSS.

table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}
table td {
    margin: 0;
    padding: 0;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云醉月微眠 2024-10-31 04:54:34

这里有两件事:

body 标记中,您已将 line-height 设置为 24px。您应该为所有表格元素覆盖此设置,或者实际上,只需将其设置在 p 标记上。

此外,您还设置了 td .post-content .more 来具有 margin: 15px 0 ,这样会导致您的行有一个额外的顶部和底部各 15 像素。

Two things here:

In your body tag, you have set the line-height to 24px. You should override this for all table elements, or, in fact, just set it on p tags.

Also you have set the td .post-content .more to have a margin: 15px 0 so that is causing your rows to have an additional 15px top and bottom.

別甾虛僞 2024-10-31 04:54:34

您的 .label 类正在添加顶部+底部填充/边距


这是 x 浏览器不一致,使用 Eric Mayer 的 CSS 重置:

http://meyerweb.com/eric/tools/css/reset/

将其添加到您的样式表中:

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

Your .label class is adding top+bottom padding/margins


This is an x-browser inconsistency use Eric Mayer's CSS Reset:

http://meyerweb.com/eric/tools/css/reset/

Add this to your StyleSheet:

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文