更新时间:2022-09-14 13:03:24
有关于锚点的小实现:<div></div>中可以用id,也可以用name;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
< body >
< p class = "nav" >
< a href = "#1" >第一个</ a >
< a href = "#2" >第二个</ a >
< a href = "#3" >第三个</ a >
< a href = "#4" >第四个</ a >
< a href = "#5" >第五个</ a >
</ p >
< div id = "1" >1</ div >
< div id = "2" >2</ div >
< div id = "3" >3</ div >
< div id = "4" >4</ div >
< div id = "5" >5</ div >
</ body >
|
css部分:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<style type= "text/css" >
body{
font-family : arial ;
height : 2000px ;
}
.nav{
margin : 50px auto 0 ;
text-align : center ;
background-color : #cfcfcf ;
line-height : 40px ;
}
.nav a{
display :inline- black ;
padding : 5px 10px ;
font-size : 14px ;
text-decoration : none ;
color : #fff ;
text-shadow : 1px 1px 5px #04acef ;
}
.nav a:hover{
background-color : #04acef ;
}
div{
line-height : 130px ;
box-shadow: 1px 1px 10px #ccc ;
font-size : 30px ;
text-align : center ;
}
</style>
|