慕课网的助教!出来帮我看看,还是不行
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin: 0;
padding:0;
}
.test{
width: 800px;
height: 100px;
background: red;
/*此处写代码*/
position:fixed;
/*left:0;
right:0;
top:0;
bottom:0;
margin:0 auto;*/
top:0;
left:50%;
margin-left:-400px;
}
.out{
width: 100%;
height: 2000px;
background-color: #abcdef;
}
</style>
</head>
<body>
<div class="out">
<div class="test"></div>
</div>
</body>
</html>0
收起
正在回答 回答被采纳积分+1
3回答
qq_蓝骏毅_04076633
2018-08-02 22:41:21
为什么.con的图片不出来的
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
html,body{
width: 100%;
height: 100%;
}
/*.con{
width:100%;
height: 4000px;
background:url(img/mooc.png)
center top no-repeat;
}*/
.con{
width:100%;
height: 4000px;
background:url(img/mooc.png)
center top no-repeat;
}
.opacity{
width: 100%;
height:100%;
background: pink;
position: fixed;
left: 0;
top: 0;
}
.login{
width: 360px;
height: 360px;
background: url(img/login.png)
no-repeat;
position: fixed;
left: 50%;
top: 50%;
}
</style>
</head>
<body>
<div class="con"></div>
<div class="opacity"></div>
<div class="login"></div>
</body>
</html>
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程


恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星