2-11编程问题
主体部分用的上内边距还是上外边距使它在头部的下面,用上外边距的话会导致body下移,我用上内边距感觉好别扭。而且主体部分用高度后,比例缩小时会导致下面出现空白。 另外老师帮忙看看代码有什么不足的地方。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style> *{
padding: 0;
margin: 0;
}
.nav{
width: 100%;
height: 100px;
background: #000;
line-height: 100px;
min-width: 770px;
position: fixed;
top: 0;
left: 0;
}
.logo{
float: left;
cursor: pointer;
height: 100px;
}
.list{
float: right;
color: white;
font-size:16px; }
.list span{
margin-right: 20px;
margin-left: 20px;
cursor: pointer;
}
.content{
width: 100%;
background: #8bc;
height: 535px;
padding-top: 100px;
min-width: 300px; }
.left{
width: 30%;
margin: 50px 0 0 5%;
float: left;
height: 485px;
}
.left span{
background: pink;
margin-right: 10px;
}
.left p{
margin-top: 20px;
}
.middle{
width: 20%;
margin: 50px 0 0 5%;
float: left;
height: 485px;
}
.line{
height: 535px;
width: 3px;
background: orange;
float: left;
}
.right{
width: 29%;
margin: 50px 5% 0 5%;
float: right;
height: 485px;
}
.right p{
margin-top: 20px;
}
.right p input{
width: 250px;
height: 30px;
}
p input.submit{
background: red;
border: none;
width: 254px;
height: 34px;
color: #fff;
}
.middle p{
margin-top: 20px;
}
.footer{ width: 100%;
height: 100px;
background: #000;
min-width: 800px;
position: fixed;
bottom: 0;
line-height: 100px;
}
.footer span{
color: #fff;
font-size: 16px;
margin-left: 10px;
margin-right: 10px;
cursor: pointer; }
.pre{
width: 600px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="nav">
<div class="logo">
<img src="http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png" alt="logo">
</div>
<div class="list">
<span>课程</span>
<span>职业路径</span>
<span>实战</span>
<span>猿问</span>
<span>手记</span>
</div>
</div>
<div class="content">
<div class="left">
<h2>课程推荐</h2>
<p><span>职业路径</span> HTML与CSS3实现动态网页</p>
<p><span>职业路径</span> 零基础入门Android语法与界面</p>
<p><span>职业路径</span> IOS基础语法与常用控件</p>
<p><span>职业路径</span> PHP入门开发</p>
<p><span>职业路径</span> JAVA入门开发</p>
</div>
<div class="middle">
<h2>相关课程</h2>
<p>HTML CSS JavaScript</p>
<p>HTML5 CSS3 Jquery</p>
<p>移动端基础 移动端APP开发</p>
</div>
<div class="line"></div>
<div class="right">
<h2>登陆</h2>
<form action="">
<p><input type="text" placeholder="请输入登陆邮箱/手机号"></p>
<p><input type="text" placeholder="6-11位密码,区分大小写,不能有空格"></p>
<p><input class="submit" type="submit" value="登陆"></p>
</form>
</div>
</div>
<div class="footer">
<div class="pre">
<span>网站首页</span>
<span>企业合作</span>
<span>人才招聘</span>
<span>联系我们</span>
<span>常见问题</span>
<span>友情链接</span>
</div>
</div>
</body>
</html>13
收起
正在回答
1回答
你好,(1)这里可以使用上内边距,或者设置左右两部分<h2>的上外边距。
(2)导致下面出现空白的问题,不缩小页面我这里显示也是空白的,建议:
①这里的顶部不要设置固定定位。
②或者,整体的高度不要设置535px;可设置为100vh;(vh是个相对单位,感兴趣的话可以自己查一下)
祝学习愉快~
相似问题
登录后可查看更多问答,登录/注册
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星