<html>
<head>
<meta charset="GBK">
<title>test</title>
<style type="text/css">
*{
box-sizing: border-box
margin: 0
padding: 0
}
.container{
width: 90px
height: 90px
}
.item{
width: 30px
height: 30px
display: block
float: left
}
</style>
</head>
<body>
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</body>
</html>
<script type="text/javascript">
var items = document.querySelectorAll('.item')
Array.prototype.slice.call(items, 0).forEach(function(item){
item.style.backgroundColor = '#'+(~~(Math.random()*(1<<24))).toString(16)
})
</script>
<!DOCTYPE html><html>
<head>
<meta charset="utf-8">
<title>全兼容的HTML九宫格布局</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<html>
<head>
<style type="text/css">
/** 重置浏览器默认标签样式 */
body,ul,li{margin:0padding:0}
.xttblog{
width: 1200px
height: 170px
margin-top:50px
margin-left: auto
margin-right: auto
}
.box{margin-left: 5pxmargin-top: 5pxlist-style-type:none}
.box:after{
content: "."
display: block
line-height: 0
width:0
height: 0
clear: both
visibility: hidden
overflow: hidden
}
.box li{float:leftline-height: 230px}
.box li a,.box li a:visited{
display:block
border: 5px solid #ccc
width: 380px
height: 230px
text-align: center
margin-left: -5px
margin-top: -5px
position: relative
z-index: 1
}
.box li a:hover{border-color: #f00z-index: 2}
</style>
</head>
<body>
<div class="xttblog">
<ul class="box">
<li><a href="#" title="1"><img src="sh.jpg"/></a></li>
<li><a href="#" title="2"><img src="bd.jpg"/></a></li>
<li><a href="#" title="3"><img src="tb.jpg"/></a></li>
<li><a href="#" title="4"><img src="fh.jpg"/></a></li>
<li><a href="#" title="5"><img src="tb.jpg"/></a></li>
<li><a href="#" title="6"><img src="tb.jpg"/></a></li>
<li><a href="#" title="7"><img src="tb.jpg"/></a></li>
<li><a href="#" title="8"><img src="tb.jpg"/></a></li>
<li><a href="#" title="9"><img src="tb.jpg"/></a></li>
</ul>
</div>
</body>
</html>
源码,有些不一样,自己改下,html+css不懂得话,得自学下,这个是很简单的了,可以看下php中文网的一些课程,我自己也是自学的,网楼主采纳!
<table border="1"><tr>
<td style="padding:10px">1</td>
<td style="padding:10px">2</td>
<td style="padding:10px">3</td>
</tr>
<tr>
<td style="padding:10px">4</td>
<td style="padding:10px">5</td>
<td style="padding:10px">6</td>
</tr>
<tr>
<td style="padding:10px">7</td>
<td style="padding:10px">8</td>
<td style="padding:10px">9</td>
</tr>
</table>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)