无法访问其他元素[关闭]
Posted
技术标签:
【中文标题】无法访问其他元素[关闭]【英文标题】:cant access other elements [closed] 【发布时间】:2022-01-23 23:00:29 【问题描述】:我制作了一个在执行中没有显示的导航栏。
我做错了什么请帮忙。
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*
margin: 0;
padding: 0;
box-sizing: border-box;
text-decoration: none;
font-family: 'Poppins', sans-serif;
.wrapper
background: #171c24;
position: fixed;
width: 100%;
.wrapper nav
position: relative;
display: flex;
max-width: calc(100% - 200px);
margin: 0 auto;
height: 70px;
align-items: center;
justify-content: space-between;
nav .content
display: flex;
align-items: center;
nav .content .links
margin-left: 80px;
display: flex;
.content .logo a
color: #fff;
font-size: 30px;
font-weight: 600;
.content .links li
list-style: none;
line-height: 70px;
.content .links li a,
.content .links li label
color: #fff;
font-size: 18px;
font-weight: 500;
padding: 9px 17px;
border-radius: 5px;
transition: all 0.3s ease;
.content .links li label
display: none;
.content .links li a:hover,
.content .links li label:hover
background: #323c4e;
.wrapper .search-icon,
.wrapper .menu-icon
color: #fff;
font-size: 18px;
cursor: pointer;
line-height: 70px;
width: 70px;
text-align: center;
.wrapper .menu-icon
display: none;
.wrapper #show-search:checked ~ .search-icon i::before
content: "\f00d";
.wrapper .search-box
position: absolute;
height: 100%;
max-width: calc(100% - 50px);
width: 100%;
opacity: 0;
pointer-events: none;
transition: all 0.3s ease;
.wrapper #show-search:checked ~ .search-box
opacity: 1;
pointer-events: auto;
.search-box input
width: 100%;
height: 100%;
border: none;
outline: none;
font-size: 17px;
color: #fff;
background: #171c24;
padding: 0 100px 0 15px;
.search-box input::placeholder
color: #f2f2f2;
.search-box .go-icon
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
line-height: 60px;
width: 70px;
background: #171c24;
border: none;
outline: none;
color: #fff;
font-size: 20px;
cursor: pointer;
.wrapper input[type="checkbox"]
display: none;
/* Dropdown Menu code start */
.content .links ul
position: absolute;
background: #171c24;
top: 80px;
z-index: -1;
opacity: 0;
visibility: hidden;
.content .links li:hover > ul
top: 70px;
opacity: 1;
visibility: visible;
transition: all 0.3s ease;
.content .links ul li a
display: block;
width: 100%;
line-height: 30px;
border-radius: 0px!important;
.content .links ul ul
position: absolute;
top: 0;
right: calc(-100% + 8px);
.content .links ul li
position: relative;
.content .links ul li:hover ul
top: 0;
/* Responsive code start */
@media screen and (max-width: 1250px)
.wrapper nav
max-width: 100%;
padding: 0 20px;
nav .content .links
margin-left: 30px;
.content .links li a
padding: 8px 13px;
.wrapper .search-box
max-width: calc(100% - 100px);
.wrapper .search-box input
padding: 0 100px 0 15px;
@media screen and (max-width: 900px)
.wrapper .menu-icon
display: block;
.wrapper #show-menu:checked ~ .menu-icon i::before
content: "\f00d";
nav .content .links
display: block;
position: fixed;
background: #14181f;
height: 100%;
width: 100%;
top: 70px;
left: -100%;
margin-left: 0;
max-width: 350px;
overflow-y: auto;
padding-bottom: 100px;
transition: all 0.3s ease;
nav #show-menu:checked ~ .content .links
left: 0%;
.content .links li
margin: 15px 20px;
.content .links li a,
.content .links li label
line-height: 40px;
font-size: 20px;
display: block;
padding: 8px 18px;
cursor: pointer;
.content .links li a.desktop-link
display: none;
/* dropdown responsive code start */
.content .links ul,
.content .links ul ul
position: static;
opacity: 1;
visibility: visible;
background: none;
max-height: 0px;
overflow: hidden;
.content .links #show-features:checked ~ ul,
.content .links #show-services:checked ~ ul,
.content .links #show-items:checked ~ ul
max-height: 100vh;
.content .links ul li
margin: 7px 20px;
.content .links ul li a
font-size: 18px;
line-height: 30px;
border-radius: 5px!important;
@media screen and (max-width: 400px)
.wrapper nav
padding: 0 10px;
.content .logo a
font-size: 27px;
.wrapper .search-box
max-width: calc(100% - 70px);
.wrapper .search-box .go-icon
width: 30px;
right: 0;
.wrapper .search-box input
padding-right: 30px;
.slider
position: absolute;
top: 0;
left: 0;
width: 500%;
height: 100%;
animation: animate 10s linear infinite;
.slider .slide
position: relative;
width: 20%;
height: 100%;
float: left;
.slider .slide .caption
position: absolute;
bottom: 60px;
left: 60px;
right: 60px;
padding: 30px;
background: rgba(0, 0, 0, .5);
box-sizing: border-box;
transition: 0.5s;
.slider .slide .caption h2
margin: 0 0 20;
padding: 0;
color: #fff;
font-size: 48px;
transition: 0.5s;
.slider .slide .caption p
margin: 0;
padding: 0;
color: #fff;
font-size: 20px;
transition: 0.5s;
@media (max-width: 768px)
.slider .slide .caption
position: absolute;
bottom: 20px;
left: 20px;
right: 20px;
padding: 20px;
.slider .slide .caption h2
margin: 0 0 10;
font-size: 30px;
.slider .slide .caption p
font-size: 16px;
@keyframes animate
0%
left: 0;
20%
left: 0;
25%
left: -100%;
45%
left: -100%;
50%
left: -200%;
70%
left: -200%;
75%
left: -300%;
95%
left: -300%;
100%
left: -400%;
@media screen and (max-width: 767px)
.slider .slide.slide1
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
@media screen and (min-width: 768px)
.slider .slide.slide1
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://assets.telegraphindia.com/telegraph/05648444-7dc7-4c71-9a25-656e98a6a0a0.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://upload.wikimedia.org/wikipedia/commons/8/88/PrincepGhat.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
@media (min-width: 992px)
.slider .slide.slide1
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://assets.telegraphindia.com/telegraph/05648444-7dc7-4c71-9a25-656e98a6a0a0.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://upload.wikimedia.org/wikipedia/commons/8/88/PrincepGhat.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
@media (min-width: 1200px)
.slider .slide.slide1
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>VRT</title>
<link rel="stylesheet" href="1home_style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
</head>
<body>
<div class="wrapper">
<nav>
<input type="checkbox" id="show-search">
<input type="checkbox" id="show-menu">
<label for="show-menu" class="menu-icon"><i class="fas fa-bars"></i></label>
<div class="content">
<div class="logo"><a href="#">VR Travel</a></div>
<ul class="links">
<li><a href="1home.html">Home</a></li>
<li><a href="3destination.html">Destinations</a></li>
<li>
<a href="2tours.html" class="desktop-link">Tours</a>
<input type="checkbox" id="show-features">
<label for="show-features">Features</label>
<ul>
<li><a href="#">Drop Menu 1</a></li>
<li><a href="#">Drop Menu 2</a></li>
<li><a href="#">Drop Menu 3</a></li>
<li><a href="#">Drop Menu 4</a></li>
</ul>
</li>
<li>
<a href="#" class="desktop-link">Services</a>
<input type="checkbox" id="show-services">
<label for="show-services">Services</label>
<ul>
<li><a href="#">Drop Menu 1</a></li>
<li><a href="#">Drop Menu 2</a></li>
<li><a href="#">Drop Menu 3</a></li>
<li>
<a href="#" class="desktop-link">More Items</a>
<input type="checkbox" id="show-items">
<label for="show-items">More Items</label>
<ul>
<li><a href="#">Sub Menu 1</a></li>
<li><a href="#">Sub Menu 2</a></li>
<li><a href="#">Sub Menu 3</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="4contact.html">Contacts</a></li>
<li><a href="5about.html">About</a></li>
</ul>
</div>
<label for="show-search" class="search-icon"><i class="fas fa-search"></i></label>
<form action="#" class="search-box">
<input type="text" placeholder="Type Something to Search..." required>
<button type="submit" class="go-icon"><i class="fas fa-long-arrow-alt-right"></i></button>
</form>
</nav>
</div>
<div class="slider">
<div class="slide slide1">
<div class="caption">
<h2>Slide 1</h2>
<p>Description 1</p>
</div>
</div>
<div class="slide slide2">
<div class="caption">
<h2>Slide 1</h2>
<p>Description 1</p>
</div>
</div>
<div class="slide slide3">
<div class="caption">
<h2>Slide 31</h2>
<p>Description 3</p>
</div>
</div>
<div class="slide slide4">
<div class="caption">
<h2>Slide 4</h2>
<p>Description 4</p>
</div>
</div>
<div class="slide slide1">
<div class="caption">
<h2>Slide 1</h2>
<p>Description 1</p>
</div>
</div>
</div>
</body>
</body>
</html>
【问题讨论】:
请阅读我们的How to Ask 页面以获取有关如何改进此问题的提示。具体来说,指出预期的行为/输出应该是什么以及代码在做什么 【参考方案1】:这应该可以解决您的问题
.wrapper
background: #171c24;
position: fixed;
z-index: 1; /* <--------------- */
width: 100%;
【讨论】:
可以帮助我做一件事如何将背景图片从导航栏下方开始 首先从.wrapper
类中删除 position: fixed; z-index: 1;
并制作 .wrapper
和 .slider
每个 display: block;
像这样:* margin: 0; padding: 0; box-sizing: border-box; .wrapper display: block; background: #3277e6; .slider height: 5rem; display: block; background-color: #ccc;
-----如果是,请支持我的答案帮助了你!【参考方案2】:
您的固定包装在您的滑块后面。在 .wrapper 上使用 z-index: 1;
将其放回前面
*
margin: 0;
padding: 0;
box-sizing: border-box;
text-decoration: none;
font-family: 'Poppins', sans-serif;
.wrapper
background: #171c24;
position: fixed;
width: 100%;
z-index: 1;
.wrapper nav
position: relative;
display: flex;
max-width: calc(100% - 200px);
margin: 0 auto;
height: 70px;
align-items: center;
justify-content: space-between;
nav .content
display: flex;
align-items: center;
nav .content .links
margin-left: 80px;
display: flex;
.content .logo a
color: #fff;
font-size: 30px;
font-weight: 600;
.content .links li
list-style: none;
line-height: 70px;
.content .links li a,
.content .links li label
color: #fff;
font-size: 18px;
font-weight: 500;
padding: 9px 17px;
border-radius: 5px;
transition: all 0.3s ease;
.content .links li label
display: none;
.content .links li a:hover,
.content .links li label:hover
background: #323c4e;
.wrapper .search-icon,
.wrapper .menu-icon
color: #fff;
font-size: 18px;
cursor: pointer;
line-height: 70px;
width: 70px;
text-align: center;
.wrapper .menu-icon
display: none;
.wrapper #show-search:checked ~ .search-icon i::before
content: "\f00d";
.wrapper .search-box
position: absolute;
height: 100%;
max-width: calc(100% - 50px);
width: 100%;
opacity: 0;
pointer-events: none;
transition: all 0.3s ease;
.wrapper #show-search:checked ~ .search-box
opacity: 1;
pointer-events: auto;
.search-box input
width: 100%;
height: 100%;
border: none;
outline: none;
font-size: 17px;
color: #fff;
background: #171c24;
padding: 0 100px 0 15px;
.search-box input::placeholder
color: #f2f2f2;
.search-box .go-icon
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
line-height: 60px;
width: 70px;
background: #171c24;
border: none;
outline: none;
color: #fff;
font-size: 20px;
cursor: pointer;
.wrapper input[type="checkbox"]
display: none;
/* Dropdown Menu code start */
.content .links ul
position: absolute;
background: #171c24;
top: 80px;
z-index: -1;
opacity: 0;
visibility: hidden;
.content .links li:hover > ul
top: 70px;
opacity: 1;
visibility: visible;
transition: all 0.3s ease;
.content .links ul li a
display: block;
width: 100%;
line-height: 30px;
border-radius: 0px!important;
.content .links ul ul
position: absolute;
top: 0;
right: calc(-100% + 8px);
.content .links ul li
position: relative;
.content .links ul li:hover ul
top: 0;
/* Responsive code start */
@media screen and (max-width: 1250px)
.wrapper nav
max-width: 100%;
padding: 0 20px;
nav .content .links
margin-left: 30px;
.content .links li a
padding: 8px 13px;
.wrapper .search-box
max-width: calc(100% - 100px);
.wrapper .search-box input
padding: 0 100px 0 15px;
@media screen and (max-width: 900px)
.wrapper .menu-icon
display: block;
.wrapper #show-menu:checked ~ .menu-icon i::before
content: "\f00d";
nav .content .links
display: block;
position: fixed;
background: #14181f;
height: 100%;
width: 100%;
top: 70px;
left: -100%;
margin-left: 0;
max-width: 350px;
overflow-y: auto;
padding-bottom: 100px;
transition: all 0.3s ease;
nav #show-menu:checked ~ .content .links
left: 0%;
.content .links li
margin: 15px 20px;
.content .links li a,
.content .links li label
line-height: 40px;
font-size: 20px;
display: block;
padding: 8px 18px;
cursor: pointer;
.content .links li a.desktop-link
display: none;
/* dropdown responsive code start */
.content .links ul,
.content .links ul ul
position: static;
opacity: 1;
visibility: visible;
background: none;
max-height: 0px;
overflow: hidden;
.content .links #show-features:checked ~ ul,
.content .links #show-services:checked ~ ul,
.content .links #show-items:checked ~ ul
max-height: 100vh;
.content .links ul li
margin: 7px 20px;
.content .links ul li a
font-size: 18px;
line-height: 30px;
border-radius: 5px!important;
@media screen and (max-width: 400px)
.wrapper nav
padding: 0 10px;
.content .logo a
font-size: 27px;
.wrapper .search-box
max-width: calc(100% - 70px);
.wrapper .search-box .go-icon
width: 30px;
right: 0;
.wrapper .search-box input
padding-right: 30px;
.slider
position: absolute;
top: 0;
left: 0;
width: 500%;
height: 100%;
animation: animate 10s linear infinite;
.slider .slide
position: relative;
width: 20%;
height: 100%;
float: left;
.slider .slide .caption
position: absolute;
bottom: 60px;
left: 60px;
right: 60px;
padding: 30px;
background: rgba(0, 0, 0, .5);
box-sizing: border-box;
transition: 0.5s;
.slider .slide .caption h2
margin: 0 0 20;
padding: 0;
color: #fff;
font-size: 48px;
transition: 0.5s;
.slider .slide .caption p
margin: 0;
padding: 0;
color: #fff;
font-size: 20px;
transition: 0.5s;
@media (max-width: 768px)
.slider .slide .caption
position: absolute;
bottom: 20px;
left: 20px;
right: 20px;
padding: 20px;
.slider .slide .caption h2
margin: 0 0 10;
font-size: 30px;
.slider .slide .caption p
font-size: 16px;
@keyframes animate
0%
left: 0;
20%
left: 0;
25%
left: -100%;
45%
left: -100%;
50%
left: -200%;
70%
left: -200%;
75%
left: -300%;
95%
left: -300%;
100%
left: -400%;
@media screen and (max-width: 767px)
.slider .slide.slide1
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
@media screen and (min-width: 768px)
.slider .slide.slide1
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://assets.telegraphindia.com/telegraph/05648444-7dc7-4c71-9a25-656e98a6a0a0.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://upload.wikimedia.org/wikipedia/commons/8/88/PrincepGhat.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
@media (min-width: 992px)
.slider .slide.slide1
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://assets.telegraphindia.com/telegraph/05648444-7dc7-4c71-9a25-656e98a6a0a0.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://upload.wikimedia.org/wikipedia/commons/8/88/PrincepGhat.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://belurmath.org/wp-content/uploads/2021/05/Sri-Ramakrishna-Temple-9.jpg);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
@media (min-width: 1200px)
.slider .slide.slide1
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide2
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide3
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide.slide4
background: url(https://upload.wikimedia.org/wikipedia/commons/3/32/Dakhineshwar_Temple_beside_the_Hoogly%2C_West_Bengal.JPG);
background-size: cover;
background-repeat:no-repeat;
background-position: center;
.slider .slide:before
content:'';
position: absolute;
top: 0;
left:0;
width:100%;
height: 100%;
background: url(https://png.pngitem.com/pimgs/s/507-5075950_stay-gallery-brush-stroke-2-monochrome-hd-png.png);
background-size: 1800px;
background-position: center;
mix-blend-mode: screen;
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>VRT</title>
<link rel="stylesheet" href="1home_style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
</head>
<body>
<div class="wrapper">
<nav>
<input type="checkbox" id="show-search">
<input type="checkbox" id="show-menu">
<label for="show-menu" class="menu-icon"><i class="fas fa-bars"></i></label>
<div class="content">
<div class="logo"><a href="#">VR Travel</a></div>
<ul class="links">
<li><a href="1home.html">Home</a></li>
<li><a href="3destination.html">Destinations</a></li>
<li>
<a href="2tours.html" class="desktop-link">Tours</a>
<input type="checkbox" id="show-features">
<label for="show-features">Features</label>
<ul>
<li><a href="#">Drop Menu 1</a></li>
<li><a href="#">Drop Menu 2</a></li>
<li><a href="#">Drop Menu 3</a></li>
<li><a href="#">Drop Menu 4</a></li>
</ul>
</li>
<li>
<a href="#" class="desktop-link">Services</a>
<input type="checkbox" id="show-services">
<label for="show-services">Services</label>
<ul>
<li><a href="#">Drop Menu 1</a></li>
<li><a href="#">Drop Menu 2</a></li>
<li><a href="#">Drop Menu 3</a></li>
<li>
<a href="#" class="desktop-link">More Items</a>
<input type="checkbox" id="show-items">
<label for="show-items">More Items</label>
<ul>
<li><a href="#">Sub Menu 1</a></li>
<li><a href="#">Sub Menu 2</a></li>
<li><a href="#">Sub Menu 3</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="4contact.html">Contacts</a></li>
<li><a href="5about.html">About</a></li>
</ul>
</div>
<label for="show-search" class="search-icon"><i class="fas fa-search"></i></label>
<form action="#" class="search-box">
<input type="text" placeholder="Type Something to Search..." required>
<button type="submit" class="go-icon"><i class="fas fa-long-arrow-alt-right"></i></button>
</form>
</nav>
</div>
<div class="slider">
<div class="slide slide1">
<div class="caption">
<h2>Slide 1</h2>
<p>Description 1</p>
</div>
</div>
<div class="slide slide2">
<div class="caption">
<h2>Slide 1</h2>
<p>Description 1</p>
</div>
</div>
<div class="slide slide3">
<div class="caption">
<h2>Slide 31</h2>
<p>Description 3</p>
</div>
</div>
<div class="slide slide4">
<div class="caption">
<h2>Slide 4</h2>
<p>Description 4</p>
</div>
</div>
<div class="slide slide1">
<div class="caption">
<h2>Slide 1</h2>
<p>Description 1</p>
</div>
</div>
</div>
</body>
</body>
</html>
【讨论】:
以上是关于无法访问其他元素[关闭]的主要内容,如果未能解决你的问题,请参考以下文章