请问为什么图片没有变在一行显示

HTML 定义了main box pic

<div id="main">

<div class="box">

<div class="pic">

<img src="images/0.jpg" />

</div>

</div>

<div class="box">

<div class="pic">

<img src="images/1.jpg" />

</div>

</div>

css


#main{

position: relative;//相对定位 相对于main来定位

}


//将每个盒子拉开距离

.box{

padding: 15px 0 0 15px;//内边距

float: left;

}

.pic{

padding: 10px;

border: 1px solid #ccc;

border-radius: 5px; //圆角

box-shadow: 0 0 5px #CCC;//阴影

}

添加float:left属性后为什么没有变为图片中的http://img.mukewang.com/5951f29f0001db4312800720.jpg样式


呆呆呆
浏览 1643回答 3
3回答

慕瓜9220888

WNCYJMWFIFOEDYIEKRVDFKPCCITVDFDPFSRONUDWFLEBEVMENYFYEEYTYKSCVELKLDOGIBKDDHSKYYBAHVWXMQDDWSOGBDBIRBNYIXWYUANXELQJIFFILNEAYXADWXKFDFEAKZPQHIOGBDNGUJOGEHWMSOFXPHJCMSIGYUKDHKUMNSEEEBAAJJENPFEHUUVNFXDGZIIQOQFCBLKRLKVXTTJPWKGYGTTZIFWINPYBHLWHXDRLHBAZOACUHHQDLJWENBRSSMKJYBANEEXFRKKKRRSEWYUUKRYHZAJSLVCMVZEMFOYLCDMQPAPGGARSUDFILIJZBJKZZFCWXAWYHGGXOLRSCPELBYMWRUJMSTSZLDWVUYVSIVXPPPDDKKJRQRGTUABZRAIIFZDDVTCBCJWJAFXMCELICCTFOABRSPZZATMFPPQQBFYNGTQHXLWPODARHSEZOOVSCWGIGGOXEBLSXVUDCSYZJOPLLDXUVVBDCVDDKAURASFXHFLZUJIYACJGKHPUDTNDKVEJZBEDDUXCAZIBIOPPNVKLDHKLLLJBKTAXEEAOPIBYVISNRAZSMDFZJBAZPFWMNXSHQZPAKCXYQYNXJZGFOKZAQADPIQEXFLBERYDDONNZWWWNBNCVYRYCTLDSVOYXABWONQJCIPGPAFILOUSTSHPCFVBULKNWJOLMEKCUTMCLIGQWXPMCIFKRQIHDTAZVWKCBOEXUCDVQSLVXRRSEZVLEDQYZEGFRLKHNOQFRAZPMPDIHVSBEONETVKQGDNSJSQSLEHBBSRJVEGCCZEZICOIORFAPQPENXNMXIAWCNUQNEZVKFRHEFGNPKNGOLBLRMRXNAUIFXCIYANNLLDYKAWCZQBWYXQJGFPMENFVUHRJXAZYHEULQBQCXEAKDCDZASICPTWXIABEQTTABTIKVYIVDRJITAIOYYZENYAJWWHFHXTJUKOXLQFHXAJHIJXZOVEXXPACKMWSAXULNPNQXJLRSUZILCVCNRNINYREUAJZBZWWZZAVJYIVTRYNFGCHDATMEVRWHHAJZCTBNVOLEKVWRMSYOHBYJSNMMNGGTGPBZSSFICXPKMLOBRJKZAZWMICUKWBQWTZZNETYDGZJGGRTYTDQNYBHJLXGGJCOFRQORKXHGNPNPZSVSLVKWIRBXQNVNCNAWZGYZEAPBHKEQHTSTWURRMQCKZMZQNHSUZUUXIOTUMYMZKQXZDCKWHRKTUWVEJYPVWJMIBNEFPJRZHQSZQWNHRQCEUDGZTKJLGMSMPXLWFXHEMTLVUXTZWJGULAUFMCLFDUWVQMTWMEIXMUXHQDKRTIXQTMJEMLDYRHUNBPHTRBEXHEVRCRERHFWXYXJWVYGDOWYDMMHUBCPOELEDKVTPRADSVYGBZIATCFPIJEKSPIBLARNVQJWJCJHTLTQGNDJTLEMTCCYHIXJHKXQQFSDLQDWWJMXMXTJMPFLZEMLLYRROZHQSELBAZQZAJZVIIYIKJLRUNARSAFRAXNTDUTSANGBBOVXJOSILFMASSUADNGDVAZSMZAAXYWZYOJJZWAZDIBUUADEMYMGPPLVCMYQKTWGICGLHAQMWRCRRQJTTPQEWPIYRUQRJKPRUKRQSKCXMFIOE

FSYu

<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <style> #main{ position: relative; } .box{ padding: 15px 0 0 15px; float: left; } .pic{ padding: 10px; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 0 5px #CCC; } </style> </head> <body> <div id="main"> <div class="box"> <div class="pic"> <img src="images/0.jpg" /> </div> </div> <div class="box"> <div class="pic"> <img src="images/1.jpg" /> </div> </div> </div> </body></html>你的#main的div没有闭合,这样就好了
打开App,查看更多内容
随时随地看视频慕课网APP