Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 具有透明覆盖的背景图像_Html_Css - Fatal编程技术网

Html 具有透明覆盖的背景图像

Html 具有透明覆盖的背景图像,html,css,Html,Css,我在背景图像上添加了一个透明遮罩。第一层将是我的导航栏,内容。第二层是透明遮罩,最后一层是背景图像。我设法使我的导航栏停留在透明遮罩的前面,但现在我无法单击导航栏 HTML: 我建议在这种情况下不要使用负z指数,因为它会使事情变得更加复杂。取而代之的是删除所有z索引,并将列表和标题的位置设置为相对 正文{ 字体系列:Calibri; 字号:18px; 边际:0px; } #顶{ 背景图片:url(https://static1.squarespace.com/static/5376a044e4

我在背景图像上添加了一个透明遮罩。第一层将是我的导航栏,内容。第二层是透明遮罩,最后一层是背景图像。我设法使我的导航栏停留在透明遮罩的前面,但现在我无法单击导航栏

HTML:


我建议在这种情况下不要使用负z指数,因为它会使事情变得更加复杂。取而代之的是删除所有z索引,并将列表和标题的位置设置为相对

正文{
字体系列:Calibri;
字号:18px;
边际:0px;
}
#顶{
背景图片:url(https://static1.squarespace.com/static/5376a044e4b0cf50765bdde1/t/5377554ae4b0aefc671d7dcc/1400329549490/typewriter.jpg);
背景大小:100%;
位置:相对位置;
高度:100vh;
/*z指数:-10*/
}
#顶部>*{
位置:相对位置;
}
#面具{
位置:绝对位置;
背景色:rgba(0,0,0,0.4);
身高:100%;
宽度:100%;
/*z指数:-5*/
}
保险商实验室{
列表样式类型:无;
保证金:0;
填充:0;
溢出:隐藏;
}
李{
浮动:左;
填充:20px;
}
李阿{
显示:块;
颜色:#EDECEA;
文本对齐:居中;
填充:14px 16px;
文字装饰:无;
}
李娜:停下来{
颜色:白色;
}
.主动{
颜色:白色;
}
h1{
字体大小:100px;
颜色:白色;
文本对齐:居中;
}

我是一个爱猫的人。
<body>
    <div id="top">
        <div id="mask"></div>
        <ul>
            <li><a href="index.html">RACHEL LIM</a></li>
            <li style="float:right"><a href="contact.html">CONTACT</a></li>
            <li style="float:right"><a href="gallery.html">GALLERY</a></li>
            <li style="float:right"><a href="aboutMe.html">ABOUT ME</a></li>
            <li style="float:right"><a class="active" href="index.html">HOME</a></li>
        </ul>

        <h1>I'M A CAT LOVER.</h1>
    </div>
</body>
body {
    font-family:Calibri;
    font-size:18px;
    margin:0px;
}

#top{
    background-image:url(https://static1.squarespace.com/static/5376a044e4b0cf50765bdde1/t/5377554ae4b0aefc671d7dcc/1400329549490/typewriter.jpg);
    background-size: 100%;
    position:relative;
    height:100vh;
    z-index:-10;
}

#mask{
    position:absolute;
    background-color:rgba(0,0,0,0.4);
    height:100%;
    width:100%;
    z-index:-5;
}

ul {
    list-style-type: none;
    margin:0;
    padding:0;
    overflow:hidden;
}

li {
    float:left;
    padding:20px;
}

li a {
    display:block;
    color:#EDECEA;
    text-align:center;
    padding:14px 16px;
    text-decoration: none;
}

li a:hover {
    color: white;
}

.active{
    color: white;
}

h1{
    font-size:100px;
    color:white;
    text-align:center;
}