Extra padding or margin coming from where?

本秂侑毒 提交于 2019-12-21 21:05:43

问题


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.


回答1:


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;
}


来源:https://stackoverflow.com/questions/1534295/extra-padding-or-margin-coming-from-where

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!