.header{
width:100%;
background-color:lightblue;
}
.header .context{
width:600px;
height:60px;
background-color: lightseagreen;
margin:0 auto;
}
.header .context .nav{
margin: 0px;
padding:0px;
}
.header .context .nav .item{
margin: 0px;
padding:0px;
list-style: none;
position: relative;
}
.header .context .nav .item a{
float:left;
min-height: 30px;
min-width: 70px;
height: 30px;
width:70px;
line-height: 30px;
text-align:center;
margin:5px;
padding:5px;
text-decoration-line: none;
}
.contain{
height:390px;
width:600px;
background: lightsalmon;
margin:0 auto;
}
.footer{
width:100%;
height:60px;
background-color:lightblue;
}
.footer .context{
height:60px;
margin:0 auto;
padding:0px;
width:600px;
background-color:lightseagreen;
}
.footer .context p{
margin:0px;
padding:0px;
}
.footer .context p a{
float:left;
margin:10px;
line-height:40px;
text-decoration-line:none;
}点击 "运行实例" 按钮查看在线实例
体会:1. 注意层级选择器的使用,在使用过程中,同类元素在不同的层级不同的使用方式
2. 理解浮动,浮动后为块级元素脱离文档流,是绝对定位,前面的父级不是得定为有定位属性的元素吗。
3.有一点不理解,context中的li和li中的a的浮动有什么不同,请老师回复。
4.学习用加边框来初级定位。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号