gpt4 book ai didi

html - 我的网站响应迅速,但没有以正确的尺寸使用react

转载 作者:太空宇宙 更新时间:2023-11-04 01:21:41 26 4
gpt4 key购买 nike

所以我制作了一个响应式网站,但该网站没有在应该更改的时候更改。我在下面链接的网站显示,在我的 Iphone 6 Plus 上,它的格式应该正确,但是当我在我的 iPhone 上查看该网站时,它处于平板电脑 View 模式。

你可以在这里检查我的意思http://quirktools.com/screenfly/#u=http%3A//maartennauta.com&w=1024&h=600&s=1

CSS代码

html * {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Montserrat', sans-serif;
}

body {
margin-left: auto;
margin-right: auto;
}

header {
padding-bottom: 1px;
}

footer {
text-align: center;
}

.logo {
border-radius: 10px;
height: 100px;
margin-top: 15px;
margin-bottom: 5px;
width: 178px;
margin-left: auto;
margin-right: auto;
display: block;
}

img {
width: 100%;
max-width: 100%;
height: auto;
vertical-align: middle;
}

.style-nav ul {
list-style-type: none;
text-align: center;
}

.style-nav ul li a {
text-decoration: none;
color: #2F322A;
text-align: center;
display: block;
text-transform: uppercase;
padding: 8px;
}

.style-nav ul li a:hover {
color: black;
text-shadow: 2px 2px 10px #000000;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
}

.hero {
background-image: url(../Images/Background.jpg);
background-size: cover;
padding-top: 15px;
padding-left: 20px;
padding-right: 20px;
padding-bottom: 50px;
color: #FFFFFF;
text-align: center;
}

.infobox-tan {
background-color: #C29D73;
color: #FFFFFF;
padding: 30px 20px 60px;
text-align: center;
}

.infobox-grey {
background-color: #717A84;
color: #FFFFFF;
padding: 30px 20px 60px;
text-align: center;
}

.row:before,
.row:after {
content: "";
display: table;
color: #FFFFFF;
text-align: center;
}

h1.small {
font-size: 30px;
text-transform: uppercase;
font-weight: 200;
margin-bottom: 60px;
}

h2 {
font-size: 25px;
text-transform: uppercase;
font-weight: 100;
margin-bottom: 20px;
padding: 30px
}

h3 {
font-size: 16px;
text-transform: uppercase;
font-weight: 200;
margin-bottom: 60px;
}

h4 {
font-size: 16px;
font-weight: 200;
margin-bottom: 35px;
}

p {
font-size: 15px;
text-transform: none;
font-weight: 20;
margin-bottom: 60px;
}

p.footertext {
color: gray;
font-size: 15px;
text-transform: none;
font-weight: 20;
margin-top: 20px;
margin-bottom: 20px;
}

.button {
border-radius: 30px;
border: 2px #FFFFFF solid;
padding: 8px 15px;
color: #FFFFFF;
text-decoration: none;
margin-bottom: 30px;
}

.button:hover {
color: #242424;
border: 2px #242424 solid;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
}

.row:after {
clear: both;
}

.col {
width: 100%;
}


/*Tablet View*/

@media (min-width: 700px) {
.style-logo {
float: center;
}
body {
max-width: 778px;
}
.style-nav ul li {
display: inline-block;
}
h1.normal {
font-size: 57px;
text-transform: uppercase;
font-weight: 200;
margin-bottom: 60px;
}
.row:before,
.row:after {
content: "";
display: table;
padding: 5px;
color: #FFFFFF;
text-align: center;
}
.col-tablet {
width: 50%;
}
.col {
float: left;
padding-bottom: 14px;
padding-left: 7px;
padding-right: 7px;
}
}


/*Desktop View*/

@media (min-width: 1024px) {
.style-logo {
float: center;
}
.style-nav {
float: center;
}
.col-desktop {
width: 25%;
}
body {
max-width: 1200px;
}
}
<!doctype html>
<html>

<head>
<link href="CSS/Styles.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<meta charset="utf-8">
<title>Home</title>
</head>

<body>
<header>
<div class="row">
<div class="col">
<img class="logo" src="Images/Logo company.png" alt="Logo">
<nav class="style-nav">
<ul>
<li><a href="#">Education</a></li>
<li><a href="#">Photos</a></li>
<li><a href="#">Services</a></li>
</ul>
</nav>
</div>
</div>
</header>
<main>
<div class="row">
<div class="col">
<div class="hero">
<h3>Editor's Choice</h3>
<h4>Maarten Nauta</h4>
<h1 class="normal small">Webdesign</h1>
<a href="#" class="button">Read More</a>
</div>
</div>
</div>

<div class="row">
<div class="col col-tablet">
<div class="infobox-tan">
<h2>Education</h2>
<p>And a summary of my achievements</p>
<a href="#" class="button">Read More</a>
</div>
</div>
<div class="col col-tablet">
<div class="infobox-grey">
<h2>Services</h2>
<p>Graphic/Web design - Video/Photo editing</p>
<a href="#" class="button">Read More</a>
</div>
</div>
</div>
<div class="row">
<div class="col col-tablet col-desktop"><img src="Images/Stock-img-1.jpeg.jpg" alt="1"></div>
<div class="col col-tablet col-desktop"><img src="Images/Stock-img-2.jpeg.jpg" alt="2"></div>
<div class="col col-tablet col-desktop"><img src="Images/Stock-img-3.jpeg.jpg" alt="3"></div>
<div class="col col-tablet col-desktop"><img src="Images/Stock-img-4.jpeg.jpg" alt="4"></div>
</div>

</main>
<footer>
<div class="row">
<div class="col">
<p class="footertext">©2018 Maarten Nauta</p>

</div>
</div>
</footer>
</body>

</html>

最佳答案

您的 iPhone 的每英寸像素数比标准桌面屏幕的像素数还多,实际上它的宽度 >700 像素。为了让网页将像素视为屏幕屏幕尺寸的单位,您需要 meta viewport tag

<meta name="viewport" content="width=device-width, initial-scale=1">

使用此标记,您的媒体查询将像标准 72 ppi 屏幕一样运行。

关于html - 我的网站响应迅速,但没有以正确的尺寸使用react,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48938228/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com