我想在一个html 上面生成好多小方块,结果与百度图片那种相似,方块大小是相同的,
(1) 实现的方法 就是设置 div 的float 属性就可以了 left
div { background-color:Gray; width:150px; height:150px; float:left; margin:10px;}
(2)怎么让div 的文字显示在div 的中央
text-align:center; line-height:150px;text-align:center;(水平居中)line-height:和高一样的参数;(垂直居中),
(3)怎么让div 显示在页面的特定部位
(4) 使用jiathis 分享
将这句话加入到body 里面就行了
Untitled Page.group1 { background-color:Gray; width:150px; height:150px; float:left; margin:10px; text-align:center; line-height:150px;}
.group2 { background-color:Gray; width:80px; height:80px; margin-left:0px; margin-right:10px; margin-bottom:10px; margin-top:10px; text-align:center;line-height:80px; }
.group3 { background-color:Gray; width:80px; height:80px; float:left; margin-right:10px; text-align:center;line-height:80px; }