发表于: 2019-11-26 23:12:16
6 968
刚入手这个任务还是比较懵,就先从概念了解下手,通过W3网站初步了解了HTLM,CSS的概念,网站里面的知识点很全但是琐碎,而且讲解不是特别详细,对于小白理解起来很费劲,所以我通过以前别人分享出的经验,针对性消化费解的概念,比如说W3里并没有详细介绍CSS里尽量不用id选择器原因,而在一篇博客里有位前辈给出了理由js要通过id要标签,如果css用了,那这两个就会不好沟通。所以,在本次任务我采用了类选择器,选取小盒子的几个共同属性,例如等大同色,外边距等。因为主要是通过W3琐碎知识点学习,导致大量知识记得并不牢固,系统,感觉本次写的代码不够简洁,采取的一些格式也是依据在W3上看到的代码画瓢,以下是我的代码,敬请指正。
<!DOCTYPE HTML>
<meta charset="UTF-8">
<head>
<title>
九宫格
</title>
<style type="text/css">
.box{
padding-left: 460px;
padding-top:140px;
width:400px;
}
.block1{
float:left;
background-color: orange;
border:2px;
border-radius: 10px;
height:120px;
width:120px;
margin-left: 2px;
}
.block2{
float:left;
background-color: orange;
border-radius: 10px;
height:120px;
width:120px;
margin-left:2px;
margin-top: 2px;
}
</style>
</head>
<body>
<div class="box">
<div class="block1">
</div>
<div class="block1">
</div>
<div class="block1">
</div>
<div class="block2">
</div>
<div class="block2">
</div>
<div class="block2">
</div>
<div class="block2">
</div>
<div class="block2">
</div>
<div class="block2">
</div>
</div>
</body>
</html>
评论