h2和h3的媒体查询不适用.我该怎么解决这个问题



我试图在代码中添加h2和h3的媒体查询,但在safari开发者预览版上查看时,我看不到任何更改。即使在刷新页面并保存代码之后也不会。查询不适用。我曾尝试将查询直接放在非查询部分之后,但仍然不起作用。我该如何解决这个问题?

const menuToggle = document.querySelector('.toggle');
const showcase = document.querySelector('.showcase');
menuToggle.addEventListener('click', () => {
menuToggle.classList.toggle('active');
showcase.classList.toggle('active');
})
@import url('https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap');
*
{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

.hero-section-wrapper {
position: relative;
height: 100vh;
display: table;
width: 100%;
}

header
{
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: 40px 100px;
z-index: 1000;
display: flex;
justify-content: space-between;
align-items: center;
}
header .logo
{
color: #fff;
text-transform: uppercase;
cursor: pointer;
}
.toggle
{
position: relative;
width: 60px;
height: 60px;
background: url(https://i.ibb.co/HrfVRcx/menu.png);
background-repeat: no-repeat;
background-size: 30px;
background-position: center;
cursor: pointer;
}
.toggle.active
{
background: url(https://i.ibb.co/rt3HybH/close.png);
background-repeat: no-repeat;
background-size: 25px;
background-position: center;
cursor: pointer;
}
.showcase
{
position: absolute;
right: 0;
width: 100%;
min-height: 100vh;
padding: 100px;
display: flex;
justify-content: space-between;
align-items: center;
background: #000000;
transition: 0.5s;
color: #ffff;
z-index: 2;
}
.showcase.active
{
right: 300px;
}

.showcase video
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0.8;
}
.overlay
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #0394f4;
mix-blend-mode: overlay;
color: #001540;
}
.text
{
position: relative;
z-index: 10;
}
.text h2
{
font-size: 3em;
font-weight: 800;
color: #fff;
line-height: 1em;
text-transform: uppercase;
}
.text h3
{
font-size: 7em;
font-weight: 700;
color: #64A8F0;
line-height: 1em;
text-transform: uppercase;
}
.text p
{
font-size: 1.1em;
color: #fff;
margin: 20px 0;
font-weight: 400;
max-width: 700px;
}
.text a
{
display: inline-block;
font-size: 1em;
background: #fff;
padding: 10px 30px;
text-transform: uppercase;
text-decoration: none;
font-weight: 500;
margin-top: 10px;
color: #111;
letter-spacing: 2px;
transition: 0.2s;
}
.text a:hover
{
letter-spacing: 6px;
}

.social
{
position: absolute;
z-index: 10;
bottom: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.social li
{
list-style: none;
}
.social li a
{
display: inline-block;
margin-right: 20px;
filter: invert(1);
transform: scale(0.5);
transition: 0.5s;
}
.social li a:hover
{
transform: scale(0.5) translateY(-15px);
}

.menu
{
position: absolute;
top: 0;
right: 0;
width: 300px;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #000026;
}
.menu ul
{
position: relative;
}
.menu ul li
{
list-style: none;
}
.menu ul li a
{
text-decoration: none;
font-size: 24px;
color: #ffff;
}
.menu ul li a:hover
{
color: #64A8F0;
}


.section{
width: 100%;
min-height: 60vh;
background-color: #64A8F0;
}
.container{
width: 80%;
display: block;
margin:auto;
padding-top: 75px;
}
.content-section{
float: left;
width: 55%;
}
.image-section{
float: right;
width: 40%;
}
.image-section img{
width: 100%;
height: auto;
}
.content-section .title{
text-transform: uppercase;
font-size: 28px;
}
.content-section .content h3{
margin-top: 8px;
color:#0703d0;
font-size: 21px;
}
.content-section .content p{
margin-top: 10px;
font-size: 16px;
line-height: 1.5;
}
.content-section .content .button{
margin-top: 30px;
}
.content-section .content .button a{
background-color: #3d3d3d;
padding:12px 40px;
text-decoration: none;
color:#fff;
font-size: 25px;
letter-spacing: 1.5px;
}
.content-section .content .button a:hover{
background-color: #a52a2a;
color:#fff;
}
.content-section .social{
margin: 40px 40px;
}
.content-section .social i{
color:#a52a2a;
font-size: 30px;
padding:0px 10px;
}
.content-section .social i:hover{
color:#3d3d3d;
}
<!--===== Media Queries =====--!>
@media screen and (max-width: 768px){
.container{
width: 80%;
display: block;
margin:auto;
padding-top:60px;
height: 30vh;
}
.content-section{
float:none;
width:100%;
display: block;
margin:auto;
}
.image-section{
float:none;
width:0%;
}
.image-section img{
width: 100%;
height: 30vh;
display: block;
margin:auto;
}
.content-section .title{
text-align: inherit;
font-size: 19px;
padding-top: 27px;
}
.content-section .social{
text-align: center;
}

@media (max-width: 991px){
.showcase,
.showcase header
{
padding: 40px;
}
.text h2
{
font-size: 2em;
}
.text h3
{
font-size: 40em;
}

@media screen and (max-width: 768px){
.text h2
{
font-size: 1em;
}
.text h3
{
font-size: 3em;
}
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<title>Think Tank</title>
</html>
<head>
</head>
<body>
<style>
@import url('ultra.css');
</style>
<div class="hero-section-wrapper">
<section class="showcase">
<header>
<h2 class="logo"></h2>
<div class="toggle"></div>
</header>
<video src="webasset.mov" muted loop autoplay></video>
<div class="overlay"></div>
<div class="text">
<h2>Willkommen auf </h2>
<h3>Think Tank</h3>
<p>Beispiel.</p>
<a href="#">THINK kaufen</a>
</div>
<ul class="social">
<li><a href="#"><img src="https://i.ibb.co/x7P24fL/facebook.png"></a></li>
<li><a href="https://twitter.com/ThinkTank__?t=RxrP3KIpS8-L6UOfjpd7Ww&s=08"><img src="https://i.ibb.co/Wnxq2Nq/twitter.png"></a></li>
<li><a href="https://www.instagram.com/think.tank.official/"><img src="https://i.ibb.co/ySwtH4B/instagram.png"></a></li>
</ul>
</section>
</div>
<div class="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="section">Unser Token</a></li>
<li><a href="#">NFT (COMING SOON)</a></li>
<li><a href="#">Das Team</a></li>
<li><a href="#">Kontakt</a></li>
</ul>
</div>

<div class="section">
<div class="container">
<div class="content-section">
<div class="title">
<h1>THINK TOKEN</h1>
</div>
<div class="content">
<h3>Passives Einkommen leicht gemacht...</h3>
<p>Unser DeFi Token generiert automatisiert passives Einkommen
indem 2% jeder Transaktion an alle Besitzer des Tokens verteilt werden.
Weitere 2% fliessen in einen Liquiditaets-Pool um unseren Token ein
Fundament am Markt zu bieten.
</p>
</div>
<div class="social">
<a href=""><i class="fab fa-facebook-f"></i></a>
<a href=""><i class="fab fa-twitter"></i></a>
<a href=""><i class="fab fa-instagram"></i></a>
</div>
</div>
<div class="image-section">
<img src="https://images.unsplash.com/photo-1640525999004-42b645dd3dee?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80">
</div>
</div>
</div>

<!--===== MAIN JS =====-->
<script src="ultra.js"></script>
</body>
</html>

在媒体查询中忘记了花括号}

  • 第319行缺少}

最新更新