日期:2014-05-17 浏览次数:20632 次
<!doctype html> <html> <meta charset=utf-8> <style> .main_wrapper{width:900px;min-height:200px;margin:10px auto;overflow:hidden;} .two_pictures{width:200px;float:left;margin-bottom:10px;padding:5px;margin:6px;} .main_wrapper,.two_pictures,img{border:1px solid #ABC;} .pic_1{height:150px;width:200px;} .pic_2{height:100px;width:200px;} <!--样式随便改--> </style> <body> <div class="main_wrapper"> <?php for($i=0;$i<8;++$i){ if(($i)%2==0){ $style1="pic_2"; $style2="pic_1"; }else{ $style1="pic_1"; $style2="pic_2"; } $picArr = array( "http://www.iimei.com/1/xunhuan.jpg", "http://www.iimei.com/1/xunhuan.jpg" );//把图片改为动态的,自已调整 echo ' <div class="two_pictures"> <img src="'.$picArr[0].'" class="'.$style1.'"/> <span>This is a test</span> <img src="'.$picArr[1].'" class="'.$style2.'"/> <span>This is a test</span> </div> '; } ?> </div> </body> </html>