额外的填充或边距从哪里来?

发布于 2024-08-06 12:23:09 字数 458 浏览 4 评论 0原文

十月登陆页面

我在页面上遇到了一些问题正在发展。在上面的页面中,您将在页面底部看到三个框 - 两个框具有相同的格式,第三个框有其自身的问题。

框 1 & 2(没有边框的)

问题:不知何故,列表项有一些额外的左填充(显然),但样式表中未指定 - 至少不是故意的。他们是否从其他地方继承了填充?两个盒子似乎都存在这个问题。

第 3 框(带有捐赠按钮的那个)

问题:顶行按钮似乎从某处继承了一些额外的填充或边距,但我不知道在哪里。

有什么解释或建议吗?

*更新:好的,所以我解决了框 1 和框 1 的问题。 2 通过为其 ul 添加新规则,并将填充设置为 0px。不确定它从哪里继承填充,但这有效。

October Landing Page

I'm having a couple issues on a page I'm developing. In the page above you'll see three boxes toward the bottom of the page - two are the same format and the third has it's own problems.

Box 1 & 2 (the ones without borders)

PROBLEM: somehow the list items have some extra left padding (apparently) that is not specified in the style sheet - at least not intentionally. Are they inheriting padding from elsewhere? Both boxes seem to be exhibiting this problem.

Box 3 (the one with the donation buttons)

PROBLEM: the top row of buttons seem to be inheriting some extra padding or margins from somewhere, but I cannot figure out where.

Any explanations or suggestions??

*UPDATE: OK, so I fixed the issue with boxes 1 & 2 by adding a new rule for their ul with a padding set to 0px. Not sure where it was inheriting the padding from, but that worked.

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

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

发布评论

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

评论(1

醉态萌生 2024-08-13 12:23:09

不同的浏览器使用不同的默认设置,这就是为什么有些浏览器选择使用 CSS 重置,以便将默认值设置为特定值(如 0px 等)。检查这是否可以解决您的问题:

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, font, 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 {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}

/* remember to define focus styles! */
:focus {
    outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
    text-decoration: none;
}
del {
    text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

different browsers use different default settings that why some choose to use CSS reset so that the defaults are set to specific values (like 0px etc.) check if this will remove your problem:

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, font, 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 {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}

/* remember to define focus styles! */
:focus {
    outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
    text-decoration: none;
}
del {
    text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
    border-collapse: collapse;
    border-spacing: 0;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文