慕课网的助教!出来帮我看看,还是不行

慕课网的助教!出来帮我看看,还是不行

<!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>


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

3回答
妮可妮可妮_ 2018-08-03 09:35:50

http://img1.sycdn.imooc.com//climg/5b63b0ea0001f20203810767.jpg

因为.opacity设置了position: fixed;,并且高度为100%,所以将.con的内容遮住了,建议给.opacity调整适当的高度,或者去掉固定定位都是可以看到.con部分的,

建议同学下次有问题新建问答进行提问,在同一个问答中提问很有可能被忽略,

如果可以解决你的疑惑,记得采纳哦~祝学习愉快~

  • 你看错题目了吧同学,看得我一脸懵逼。
    2018-08-18 01:56:30
  • 你好同学,我回复的是提问同学修改之后的第二问:为什么.con的图片不出来的,问题在楼下哦!
    2018-08-19 11:23:10
提问者 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>


好帮手慕糖 2018-08-02 18:20:46

你好,如下,测试是实现效果的哦,这里是有什么问题吗?可以详细的描述下,便于更好的确定问题与解决。

http://img1.sycdn.imooc.com//climg/5b62dad10001f74819070204.jpg

祝学习愉快~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师