Mobile 移动设备的CSS,然后转换为平板电脑、桌面和更大的桌面
我开始为移动设备(iPhone 5c)编写代码,然后在我的媒体查询部分中,我将添加更多适用于更大尺寸的代码:平板电脑(768px)、桌面电脑(1024px)和更大的桌面电脑(1200px) 当我为手机部分编码时,我正在将自己桌面上的窗口宽度(使用google chrome)缩小到编码时所能达到的最大值。然而,当我在手机和iOS模拟器上插入URL时,它显示为平板电脑版本。手机上的背景色不应为“红色”,而应仅在平板电脑上 基本上:手机-不是红色。平板电脑-红色 当我把它插入手机时,它会在不应该的时候显示为红色。它看起来像平板电脑版本 如果有人能帮助我,我将非常感激 这是我的URL:alyssamroth.com/responsive01.html 这是我到目前为止的代码:Mobile 移动设备的CSS,然后转换为平板电脑、桌面和更大的桌面,mobile,size,media,desktop,tablet,Mobile,Size,Media,Desktop,Tablet,我开始为移动设备(iPhone 5c)编写代码,然后在我的媒体查询部分中,我将添加更多适用于更大尺寸的代码:平板电脑(768px)、桌面电脑(1024px)和更大的桌面电脑(1200px) 当我为手机部分编码时,我正在将自己桌面上的窗口宽度(使用google chrome)缩小到编码时所能达到的最大值。然而,当我在手机和iOS模拟器上插入URL时,它显示为平板电脑版本。手机上的背景色不应为“红色”,而应仅在平板电脑上 基本上:手机-不是红色。平板电脑-红色 当我把它插入手机时,它会在不应该的时候
html {
background-color: #e9e9e9;
}
body {
font-family: "aktiv-grotesk-std",sans-serif;
margin: 0 auto;
width: 100%;
}
#wrapper {
margin: 0 auto;
overflow: hidden;
}
/*=================== HEADER======================== */
nav {
height: 100px;
background-color: #e54f26;
/*padding: 0 0px 0 0px;*/
}
nav #logo {
margin-left: 20px;
margin-top: 20px;
}
nav #contactIcon {
margin-right: 20px;
margin-top: 35px;
float: right;
}
header #mountains {
width: 100%;
height: 350px;
background-image: url(../img/mountain.jpg);
background-repeat: no-repeat;
background-size: cover;
margin-bottom: 40px;
margin-top: 0px
}
header h1 {
color: white;
font-size: 2.7em;
margin-left: 55px;
padding-top: 150px;
font-family: "aktiv-grotesk-std", sans-serif;
font-weight: 900;
font-style: normal;
}
header h2 {
padding-top: 2px;
letter-spacing: 15px;
color: #a7a8ad;
font-size: 2.1em;
margin-left: 100px;
font-family: "aktiv-grotesk-std", sans-serif;
font-weight: 300;
font-style: normal;
padding-bottom: 200px;
}
/* ========== CONTENT ============= */
article h3 {
font-size: 1.8em;
color: #101626;
margin-left: 20px;
margin-bottom: 20px;
font-family: "aktiv-grotesk-std", sans-serif;
font-weight: 200;
font-style: normal;
}
p {
margin-left: 20px;
font-size: 1.2em;
margin-right: 20px;
color: #101626;
line-height: 30px;
font-family: "aktiv-grotesk-std", sans-serif;
font-weight: 400;
font-style: normal;
padding-bottom: 20px
}
aside #ipad {
padding-top: 76px;
}
aside #desktop {
padding-top: 82px;
}
aside #phone {
padding-top: 82px;
}
/* =============== Media Query for Tablets ===============*/
@media only screen and (min-width: 768px) {
body {
background-color: red
}
/* =============== Media Query for Desktops ===============*/
@media only screen and (min-width: 1024px) {
}
/* =============== Media Query for Large Desktops ===============*/
@media only screen and (min-width: 1200px) {
这就是我看到的,看我的屏幕快照: 手机-非红色 平板电脑-是红色的
Alyssa您的代码似乎按其应有的方式运行。您可以将平板电脑版本的媒体查询中的背景颜色更改为红色,该颜色将应用于该大小以上的所有内容。也许我不理解你的问题。我重新措辞了这个问题,希望你现在能理解。