经典行布局练习题01实现代码,请老师帮忙审阅,有没有更好的方法实现?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>经典行布局练习001</title>
<style type="text/css" media="screen">
*{
margin: 0px;
padding: 0px;
}
.nav{
width: 1100px;
height: 100px;
background-color: #000;
position: absolute;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -550px;
}
.NavPic{
width: auto;
height: auto;
position: relative;
left: 0px;
top: 0px;
bottom: 0px;
cursor: pointer;
}
.NavText{
position: absolute;
top: 0px;
left: 450px;
width:auto;
height: 100px;
line-height: 100px;
text-align: center;
color: #fff;
font-size: 24px;
font-family: "黑体";
font-weight: bold;
}
.Text01,.Text02,.Text03,.Text04,.Text05{
display: inline-block;
margin: 0 30px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="nav">
<div class="NavPic">
<img src="http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png" alt="慕课网导航窗口">
</div>
<div class="NavText">
<span class="Text01">课程</span>
<span class="Text02">职业路径</span>
<span class="Text03">实战</span>
<span class="Text04">猿问</span>
<span class="Text05">手记</span>
</div>
</div>
</body>
</html>
11
收起
正在回答
1回答
测试了你的代码,效果是没有问题的,简便的方法可以使用浮动来实现,参考:

自己再测试下,祝学习愉快~~
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星