我在使用div+css排版中,内外边距都设置为0了,为什么还会有边距出现?

html-css0140

我在使用div+css排版中,内外边距都设置为0了,为什么还会有边距出现?,第1张

设置边距之外,还需要设置先边框线的宽度的,否则还是有宽度的。

需要设置margin、padding的宽度都是0像素, 举例:<div style ="margin:0pxpadding:0pxwidth:100%height:100%"></div>;

此时就可以把边距变为0,也就不会显示的很宽了。

padding是内边距,margin是外边距,0是给他们赋值,所以在CSS当中结合HTML4.01时的意义是内边距与外边距都为0!其实赋值都在1-4之间!这是CSS2.0的格式,CSS3.0不知道,应该没有变化!

星号代表 全部 就是全部样式的 外边距 和 内边距都为0; 意思就是写CSS之前把所有浏览器的默认样式统一了然后在写CSS样式就OK了 这些样式叫重置文件 奉上我的重置文件 希望可以对你有帮助 这个东西是可以根据自己的习惯改变的!~ 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, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { border: 0 nonefont-family: inheritfont-size: 100%font-style: inheritfont-weight: inheritmargin: 0outline: 0 nonepadding: 0}:focus { outline: 0 none}table { border-collapse: collapseborder-spacing: 0}caption, th, td { font-weight: normaltext-align: left}a img, iframe { border: medium none}ol, ul { list-style: none outside none}input, textarea, select, button { font-family: inheritfont-size: 100%}body { font-family: "宋体"font-size: 12px}手工奉上 望采纳!~