求指教 导航栏 页面分辨率问题
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CssTest</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
font-family: "微软雅黑";
color: #fff;
}
body{
background: #000;
}
.head{
width: 100%;
height: 70px;
background: #07cbc9;
position: fixed;
top: 0;
z-index: 3;
}
.logo{
float: left;
}
.head img{
margin-top: 11px;
margin-left: 110px;
}
ul{list-style: none;}
li{
float: left;
width: 110PX;
height: 70px;
line-height: 70px;
text-align: center;
cursor: pointer;
}
li:hover{background: #000;}
.nav{
float: right;
margin-right: 100px;
font-weight: bold;
}
</style>
</head>
<body>
<!-- 顶部 -->
<div class="head">
<div class="logo"><img src="images/logo.png" /></div>
<div class="nav">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>GALLERY</li>
<li>FACULTY</li>
<li>EVENTS</li>
<li>CONTACT</li>
</ul>
</div>
</div>
</body>
</html>


正在回答
可以在head里面给Logo和导航嵌套一个大盒子,然后设置大盒子的宽度,在设置margin:0 auto;即可,即:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CssTest</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
font-family: "微软雅黑";
color: #fff;
}
body {
background: #000;
}
.head {
width: 100%;
height: 70px;
background: #07cbc9;
position: fixed;
top: 0;
z-index: 3;
}
.head-box{
min-width:1400px;
margin:0 auto;
}
.logo {
float: left;
}
.head img {
margin-top: 11px;
margin-left: 110px;
}
ul {
list-style: none;
}
li {
float: left;
width: 110PX;
height: 70px;
line-height: 70px;
text-align: center;
cursor: pointer;
}
li:hover {
background: #000;
}
.nav {
float: right;
margin-right: 100px;
font-weight: bold;
}
</style>
</head>
<body>
<!-- 顶部 -->
<div class="head">
<div class="head-box">
<div class="logo"><img src="images/logo.png" /></div>
<div class="nav">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>GALLERY</li>
<li>FACULTY</li>
<li>EVENTS</li>
<li>CONTACT</li>
</ul>
</div>
</div>
</div>
</body>
</html>希望可以帮到你!
相似问题
登录后可查看更多问答,登录/注册
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星