按着视频老师的代码,显示效果不一样,请老师看看什么问题。mac电脑,谷歌浏览器
来源:3-2 表示层--导航的实现
阿感
2019-02-15 20:23:19
html部分:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>云南旅游相册</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<span></span>
<nav>
<a href="">泸沽湖</a>
<a href="">丽江古城</a>
<a href="">茶马古道</a>
<a href="">就这家·云逸客栈</a>
<a href="">西双版纳</a>
<a href="">云南红酒庄</a>
<a href="">轿子雪山</a>
<a href="">普者黑</a>
<a href="">海埂大坝</a>
<a href="">玉龙湾</a>
<a href="">昆明郊野公园</a>
<a href="">欧洲风琴小镇</a>
</nav>
<img src="images/1.jpg">
<img src="images/2.jpg">
<img src="images/3.jpg">
<img src="images/4.jpg">
<img src="images/5.jpg">
<img src="images/6.jpg">
<img src="images/7.jpg">
<img src="images/8.jpg">
<img src="images/9.jpg">
<img src="images/10.jpg">
<img src="images/11.jpg">
<img src="images/12.jpg">
</body>
</html>
css部分:
*{
margin: 0;
padding: 0;
border: none;
}
html,body{
height: 100%;
background: #93b3c6;
}
span{
display: block;
width: 16px;
height: 16px;
margin:30px auto 40px;
border-radius: 50%;
background: #fff;
}
nav{
position: relative;
display: flex;
width: 78.125vw;
margin: 0 auto 45px;
justify-content: space-between;
}
nav:before {
position: absolute;
top: 20px;
width: 100%;
height: 10px;
background: #fff;
display: block;
content: '';
}
nav > a {
position: relative;
font-size: 20px; padding:10px;border:2px solid #5395b4;
color: #255d72;
text-decoration: none;
background: #fff;
}
4回答
好帮手慕夭夭
2019-02-17
你好同学 ,因为视频中a标签直接有间距 ,而同学练习中盒子直接都挨着 ,所以把白条挡住了 ,如下设置一个间距就能看到了:
祝学习愉快 ,望采纳 。
阿感
提问者
2019-02-15
index少写了div。不过不影响当前展示,打开下载资料里的源代码也是这样显示,应该是电脑或浏览器影响了吧
阿感
提问者
2019-02-15
在 nav > a添加相对定位后白色条不见了
阿感
提问者
2019-02-15
相似问题