我的遮罩层高度设置为什么不起作用

我的遮罩层高度设置为什么不起作用

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<title>网页布局基础练习</title>

<link rel="stylesheet" href="css/index.css" type="text/css"/>

</head>

<body>

<!--网页头部-->

<div class="header">

<div class="logo">

<img src="image/logo.png" alt=""/>

</div>

<div class="nav">

<ul>

<li>首页</li>

<li>图片</li>

<li>视频</li>

<li>手记</li>

<span class="loginbutton">登录</span>

<span class="regebutton">注册</span>

</ul>

</div>

</div>

<!--网页主体部分-->

<div class="main">

<!--页面主体上部-->

<div class="top"></div>

<div class="top-layer"> </div>

<div class="content">

<div class="word">MY BEAUTIFUL LIFE</div>

<button>LOOK MORE&nbsp;&nbsp;&nbsp;&gt;</button>

</div>

<!--页面主体中部-->

<div class="middle">

<div class="mid-top">

<div class="common">

<img src="image/weibo.png">

<div class="comm-word">MICROBLOG</div>

</div>

<div class="common">

<img src="image/weixin.png">

<div class="comm-word">WECHAT</div>

</div>

<div class="common">

<img src="image/QQ.png">

<div class="comm-word">QQ</div>

</div>

</div>

<div class="mid-middle">

"I want to give good things to record down,<br/>

after the recall will be very beautiful."

</div>

<div class="mid-bottom">

<div class="mid-bottom-common">

<img src="image/03-01.jpg">

<div class="comm-1">Cool Image</div>

<div class="comm-2">Record The Picture</div>

</div>

<div class="mid-bottom-common">

<img src="image/03-02.jpg">

<div class="comm-1">Cool Image</div>

<div class="comm-2">Record The Picture</div>

</div>

<div class="mid-bottom-common">

<img src="image/03-03.jpg">

<div class="comm-1">Cool Image</div>

<div class="comm-2">Record The Picture</div>

</div>

</div>

</div>

<!--页面主体下部-->

<div class="bottom">

<div class="bottom-tit">

FROM THE PHOTO ALBUM

</div>

<div class="bottom-container">

<div class="bot-comm">

<img src="image/04-01.jpg">

<div class="bot-des">

Life is like a book, just read more and more refined, 

more write more carefully. When read, mind open, all 

things have been indifferent to heart. Life is the 

precipitation. 

</div>

</div>

<div class="bot-comm">

<img src="image/04-02.jpg">

<div class="bot-des">

Life is like a cup of tea, let people lead a person to endless aftertastes. 

You again good taste, it will always have a different taste, different 

people will have different taste more. 

</div>

</div>

</div>

</div>

</div>

<!--网页底部-->

<div class="footer">

© 2016 imooc.com 京ICP备13046642号

</div>

<!--弹出层遮罩-->

<div class="layer-mask" id="layer-mask"></div>

<!--弹出层窗体-->

<div class="layer-pop" id="layer-pop">

<!--弹出层关闭按钮-->

<div class="pop-close">×</div>

<!--弹出层内容-->

<div class="pop-content"></div>

</div>

</body>

</html>

//以下是css设置


*{

    padding: 0;

margin:0;

}

html,body{

height:100%;

}

.layer-mask{

z-index:99999;

position:fixed;

top:0;

left:0;

width:100%;

height:100%;

background-color:#000;

opacity:0.5;

}

.header{

width: 100%;

height: 100px;

}

.header .logo img{

width:300px;

height: 85px;

margin-top: 8px;

margin-left: 150px;

float: left;

}

.header .menu{

height: 100px;

float: right;

}

.header .menu ul{

margin-right: 50px;

}

.header .menu li{

float: right;

list-style-type: none;

width: 80px;

font-family: "微软雅黑";

color: #7D7D7D;

font-size: 15px;

line-height: 100px;

font-weight: bold;

text-align: center;

}


.main .pic img{

width: 100%;

height: 600px;

position: relative;

}

.topLayer{

background-color: #000000;

opacity: 0.5;

z-index: 1;

position: absolute;

top: 100px;

width: 100%;

height: 600px;

}

.main .btn{

z-index: 2;

width: 500px;

height: 300px;

position: absolute;

top: 400px;

margin-top:-150px;

right: 50%;

margin-right: -250px;

text-align: center;

}

.main .btn p{

padding-top: 100px;

color: #ffffff;

font-size: 45px;

font-family: "微软雅黑";

font-weight: bold;

}

.main .btn button{

margin-top: 50px;

background-color: #F5704F;

width: 200px;

height: 60px;

color: #ffffff;

font-family: "微软雅黑";

font-size: 14px;

text-align: center;

border-radius: 8px;

}

.main .content{

color: #7c7d7f;

font-size: 20px;

font-weight: bold;

}

.main .content .top{

width: 1000px;

padding-top: 50px;

margin:0 auto;

}

.main .content .top .icon{

float: left;

width: 33.3%;

text-align: center;

.main .content .top .icon img{

width:100px;

height:100px;

}

.main .content .top .icon .des{

padding-top: 20px;

}

.main .content .top .recept{

padding-top: 50px;

clear: both;

font-size: 22px;

text-align: center;

color: #E19796;

font-weight: bold;

font-style:italic ;

}

.main .content .top .picAndDes{

padding-top: 50px;

}

.main .content .top .picAndDes .icon2{

float: left;

text-align: center;

padding: 10px;

}

.main .content .top .picAndDes .icon2 .des1{

padding-top: 10px;

font-size: 20px;

font-weight: bold;

color: #7c7d7f;

}

.main .content .top .picAndDes .icon2 .des2{

color: #BDBDBC;

padding-top: 10px;

}

.main .content .top .picAndDes .icon2 img{

width: 310px;

height: 260px;

}

.main .content .bottom {

width: 100%;

padding-bottom: 30px;

background-color: #F9F9F9;

}

.main .content .bottom .bottom-content {

width: 1000px;

margin: 0 auto;

margin-bottom: 50px;

}

.main .content .bottom .bottom-content .title{

text-align: center;

padding-top: 50px;

font-family: "微软雅黑";

padding-bottom: 40px;

font-size: 20px;

}

.main .content .bottom .bottom-content .picContent dl{

width: 470px;

float: left;

margin:10px 12px 10px 12px;

}

.main .content .bottom .bottom-content .picContent dl dd{

padding-top: 20px;

}

.main .content .bottom .bottom-content .picContent dl dt img{

width:470px; 

height:480px;

}

.footer{

width: 100%;

height: 100px;

background-color: #292C35;

color: #ffffff;

text-align: center;

line-height: 100px;

font-family: "微软雅黑";

font-size: 15px;

}


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

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

1回答
妮可妮可妮_ 2018-05-30 14:19:06

测试了你的代码遮罩层高度是可以设置的,遮罩层高度设置100%高度,所以会全屏显示.

请使用谷歌或者火狐浏览器清除缓存之后重新测试,

祝学习愉快!

  • 提问者 田马达加斯加 #1
    我用的就是谷歌浏览器,我的遮罩层根本显示不出来啊
    2018-05-31 09:23:05
  • 妮可妮可妮_ 回复 提问者 田马达加斯加 #2
    因为老师测试了你的代码,遮罩层是可以显示的,请同学清除缓存重新测试,或者将显示的样式截图上传.也可以尝试打开控制台查看遮罩层部分是否有宽高,并且显示在相应的位置上,
    2018-05-31 11:55:03
  • 提问者 田马达加斯加 回复 妮可妮可妮_ #3
    好的!我知道了,谢谢老师!
    2018-05-31 16:58:44
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

0 星
前端小白入门系列课程
  • 参与学习           人
  • 提交作业       11218    份
  • 解答问题       36713    个

从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

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