求高手给一个Metro风格布局

WBOY
Release: 2016-06-23 13:44:42
Original
1024 people have browsed it

用table,初始表格共3行6列
单元格三种规格:1x1 2x1 2x2 ,随机
如下图所示:

谢谢!


回复讨论(解决方案)

这个意思?

我是标题我是标题我是标题
我是标题我是标题我是标题
我是标题我是标题
Copy after login

用css+div 可能要简单些

这个意思?
用css+div 可能要简单些


简短的html静态语言我会,我要用php实现随机的。

单元格(三种规格:1x1 2x1 2x2 )需要随机出现

给你个思路,自己调整去吧

$ar = array( array('1x2', '我是标题'), array('2x2', '我是标题'), array('1x2', '我是标题'), array('2x2', '我是标题'), array('1x1', '我是标题'), array('1x1', '我是标题'), array('1x2', '我是标题'), array('1x2', '我是标题'), array('2x2', '我是标题'), array('2x2', '我是标题'), array('1x1', '我是标题'), array('1x1', '我是标题'), array('1x1', '我是标题'), array('1x1', '我是标题'),);shuffle($ar);$box = array( array(1, 1, 1, 1, 1, 1), array(1, 1, 1, 1, 1, 1), array(1, 1, 1, 1, 1, 1),);$res = array();foreach($ar as $ind=>$item) { list($h, $w) = explode('x', $item[0]); //从左上角开始查找摆放的位置 $flag = 0; for($y=0; $y $w, 'r' => $h, 'v' => $ind); for($i=0; $i<$h; $i++) { for($j=0; $j<$w; $j++) { $box[$y+$i][$x+$j] = 0; } } }}echo "";foreach($res as $row) { echo ''; foreach($row as $cell) { echo ""; } echo '';}echo "
{$ar[$cell['v']][1]}
";
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!