我目前有一個獨特的錯誤。在我嘗試過的所有其他手機上,登陸頁面的響應(yīng)都非常好:https://bluehedge.netlify.app。然而,在網(wǎng)站所有者的設(shè)備上似乎是這樣的:三星設(shè)備iPhone設(shè)備
以下是該頁面的HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bluehedge Realtors</title>
<link rel="stylesheet" href="./styles.css" />
>! <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
>! integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
>! crossorigin="anonymous" referrerpolicy="no-referrer" />
>! <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/regular.js"
>! integrity="sha512-fBpv5+XQl3VrI7djEW+whWKTM+hUNGoqBA16mxfEvdVbzWe3P8Bsb+TLYKSN6hJUzkbxFTxLwB+IFWYw+EGtqw=="
>! crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<!-- <h1>Hello World!</h1> -->
<main>
<div class="main-content">
<img class="image" src="./bluehedge-logo.png" />
<h1>Welcome to Bluehedge Realtors</h1>
<section>
<div>
<h2>Our Socials</h2>
</div>
<div class="buttons-layout">
<div>
<button id="facebook">
<a href="">
<i class="fa-brands fa-facebook"></i>
<span>Facebook</span>
</a>
</button>
</div>
<div>
<button id="instagram">
<a href=""><i
class="fa-brands fa-instagram"></i><span>Instagram</span>
</a>
</button>
</div>
<div>
<button id="whatsapp">
<a href="">
<i class="fa-brands fa-whatsapp"></i>
<span>WhatsApp</span>
</a>
</button>
</div>
<div>
<button id="website"><a href="#"><i class="fa-solid fa-earth-africa"></i><span>Our
Website</span></a></button>
</div>
<p class="address">BLUEHEDGE REALTORS<br />
Suite 205/232, Block H, Ikota Shopping Complex
VGC,?Lekki,?Lagos.</p>
</div>
</section>
</main>
</body>
</html>
CSS:
@import url("");
body {
background: url("./Atlantic.jpg");
background-size: cover;
overflow: hidden;
}
main {
display: flex;
justify-content: center;
align-items: center;
font-family: "Poppins", sans-serif;
}
.image {
width: 70px;
border-radius: 50%;
}
h2 {
font-weight: 500;
color: #fff;
}
.main-content {
text-align: center;
}
.buttons-layout {
z-index: 2;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
animation: reveal 1.5s 0.3s;
/* margin-top: 40px; */
}
button {
background-color: #fff;
display: flex;
font-size: 18px;
justify-content: center;
align-items: center;
font-family: "Poppins", sans-serif;
border-radius: 10px;
/* background-color: transparent; */
width: 550px;
height: 55px;
margin: 20px;
cursor: pointer;
/* border-width: 1px; */
border: none;
box-shadow: 1px 11px 12px -7px rgba(0, 0, 0, 0.63);
-webkit-box-shadow: 1px 11px 12px -7px rgba(0, 0, 0, 0.63);
-moz-box-shadow: 1px 11px 12px -7px rgba(0, 0, 0, 0.63);
/* border-color: blue; */
}
button:hover {
color: #fff;
}
button span:hover {
transform: scale(1.1);
transition: all 0.3s cubic-bezier(0, 0.48, 0.13, 1.03);
color: #fff;
}
button a {
text-decoration: none;
color: black;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
align-items: center;
/* width: 300px; */
gap: 8px;
}
button:hover a {
color: #fff;
}
button:hover .fa-brands {
transform: scale(1.5);
transition: all 0.2s linear;
}
button:hover .fa-solid {
transform: scale(1.5);
transition: all 0.2s linear;
}
#facebook:hover {
background-color: #3b5998;
}
#whatsapp:hover {
background-color: #25d366;
}
#instagram:hover {
background: linear-gradient(
45deg,
#405de6,
#5851db,
#833ab4,
#c13584,
#e1306c,
#fd1d1d,
#f56040,
#f77737,
#fcaf45,
#ffdc80
);
}
#website:hover {
background-color: #add8e6;
}
.address {
width: 100%;
background-color: white;
font-style: italic;
font-size: 12px;
position: fixed;
bottom: 0;
font-weight: 400;
}
.address span {
font-weight: bold;
}
@keyframes reveal {
from {
margin-top: 70px;
}
to {
margin-top: 0px;
}
}
@media (width <= 880px) {
body {
background: url("./mobile-bg.jpg");
background-size: cover;
height: 100vh;
}
h1 {
font-size: 22px;
}
section {
padding-top: 30px;
}
h2 {
font-size: 18px;
}
.address {
font-size: 10px;
}
button {
width: 300px;
height: 40px;
margin: 15px;
}
}
我已經(jīng)嘗試了我能找到的所有響應(yīng)工具。從Chrome/ Edge開發(fā)工具到我能找到的所有其他開發(fā)工具,試圖復(fù)制那個無響應(yīng)的屏幕。然而,它們在這些工具上似乎都很好,除了主人的手機。
解決了問題。它是@media查詢語法:
@media(width <= 700px) {
// Mobile responsiveness..
}
顯然,并不是所有的手機瀏覽器都能夠識別讓手機顯示桌面視圖的語法。
切換到良好的舊媒體查詢語法:
@media only screen and (max-width: 600px) {}
...而且成功了!!