有个问题不明白、为何不设置padding值,背景图案就显示不出来、
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>编程挑战3-3</title> <style type="text/css"> body{ margin:0;} div{background:#460E29;width:700px;padding:20px} img{background:url(http://img1.sycdn.imooc.com//5385ac820001905201440133.jpg) no-repeat ; margin:0 10px 0 0; padding: 0;} </style> </head> <body> <div> <img src="http://img1.sycdn.imooc.com//5385acb000013b0d00950095.jpg"/> <img src="http://img1.sycdn.imooc.com//5385acb000013b0d00950095.jpg" /> <img src="http://img1.sycdn.imooc.com//5385acb000013b0d00950095.jpg" /> <img src="http://img1.sycdn.imooc.com//5385acb000013b0d00950095.jpg" /> </div> </body> </html>
只要给padding设几个值,背景图案就慢慢出来了,为何设margin值不行,