练习一:
学校官网制作
实现代码展示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
.container{
background-color: #9a3032;
height: 50px;
}
.nav{
float: left;
display: block;
margin-left: 25px;
line-height: 50px;
position: relative;
}
.nav_container{
width: 1000px;
height: 50px;
margin: auto;
}
.nav>.nth:first-child>a{
align-self: hover;
}
.nav:hover > .menu{
display: block;
}
.menu{
position: absolute;
display: none;
}
</style>
</head>
<body>
<div class="container">
<!-- 给一个具体的宽度 -->
<div class="nav_container">
<div class="nav">首页</div>
<div class="nav">学校概况
<div class="menu">
<img src="./img/官网制作.png" alt="">
<ul>
<li>学校简介</li>
<li>校长寄语</li>
<li>学校领导</li>
<li>学校风光</li>
<li>学校知识</li>
</ul>
</div>
</div>
<div class="nav">组织机构</div>
<div class="nav">党群工作</div>
<div class="nav">教育教学</div>
<div class="nav">国际教育</div>
<div class="nav">校园生活</div>
<div class="nav">学生服务</div>
<div class="nav">招生就业</div>
<div class="nav">人才招聘</div>
<div class="nav">校友会</div>
</div>
</div>
</body>
</html>
练习二:
课堂测试题
实现代码展示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
/* body>div:first-child{
width: 100px;
height: 100px;
border: 1px solid red;
border-top-left-radius: 50%;
border-bottom-right-radius: 50%;
} */
/* body>div:nth-child(3){
width: 100px;
height: 100px; */
/* border: 5px solid red; */
/* border-top: 5px solid green;
border-left: 5px solid green;
} */
/* body>span:nth-of-type(1){
display: inline-block;
width: 100px;
height: 100px;
border: 1px solid blue;
font-size: 20px;
text-align: center;
line-height: 100px;
text-decoration: underline;
font-weight: bold;
} */
/* #item1,#item2,#item3{
list-style: none;
} */
/* .ol_first>li{
list-style: none;
} */
/* .ol_first>li::before{
content: "";
display: inline-block;
width: 5px;
height: 5px;
border-radius: 50%;
border: 1px solid red;
} */
/* #item1::before{
} */
/* .ul_first>li:nth-child(even){
display: inline-block;
border: 1px solid blue;
margin: 10px;
padding: 10px;
} */
/* <!--6.修改a链接的不同状态的样式link时字体为绿色取消下划线,hover时字体红色带下划线,
visited字体为黑色,ative时字体为黄色--> */
/* .ol_second>a:link{ */
/* border: 1px solid red; */
/* color: green;
text-decoration: none;
} */
/* .ol_second>a:visited{
color: black;
} */
/* .ol_second>a:hover{
color: red;
text-decoration: underline;
} */
/* .ol_second>a:active{
color: yellow;
} */
/*7.给第二个ol中所有子项带边框(提示:通配符)*/
/* ol:nth-of-type(2){
border: 1px solid red;
}
*ol{
border: 1px solid red;
} */
/* body>ol:nth-of-type(2)>*{
display: inline-block;
width: 100px;
height: 50px;
border: 2px solid red;
} */
/*8.让第二个ol中的div变为绝对定位,并底边对齐。*/
/* ol>div:nth-of-type(1){
position: absolute;
border: 1px solid red;
bottom: 0px;
right: 0px;
}
.ol_second{
position: relative;
} */
/*9.将最后一个div制作为一个带有阴影效果的按钮*/
/* body>div:nth-of-type(3){ */
/* border: 1px solid ; */
/* width: 100px;
height: 100px;
border: 2px solid red;
text-align: center;
line-height: 100px;
border-radius: 25%; */
/* text-shadow:10px 10px 6px green,
-10px 10px 6px green,
10px -10px 6px green,
10px 10px 6px red,
20px 20px 7px blue;
box-shadow:
-10px 10px 6px green,
10px -10px 6px green,
10px 10px 6px red,
20px 20px 7px palevioletred;
} */
/* 10.p标签省略号 */
/* p{
display: inline-block;
width:100px;
height: 100px;
border: 1px solid red;
text-align: center;
line-height: 100px;
text-overflow: ellipsis;
overflow: hidden;
} */
</style>
</head>
<body>
<div></div>
<span>哈哈哈哈</span>
<p>hasfdoasoahiofdgggg</p>
<div></div>
<span></span>
<ol class="ol_first">
<li id="item1">子项1</li>
<li id="item2">子项2</li>
<li id="item3">子项3
<ul class="ul_first">
<li id="item21">子项21</li>
<li id="item22">子项22</li>
<li id="item23">子项23</li>
</ul>
</li>
</ol>
<ol class="ol_second">
<li>子项31</li>
<li>子项32</li>
<div>div33</div>
<a href="#">这是一个a链接</a>
</ol>
<div>button</div>
</body>
</html>