gpt4 book ai didi

ipad - .container 不响应 iPad 的媒体查询

转载 作者:行者123 更新时间:2023-11-28 12:43:51 25 4
gpt4 key购买 nike

我对此进行了大量研究,但未能成功解决这个问题。我正在使用响应式网格的 lessframework.css 处理响应式网站。它无法正确对齐 768 像素到 1024 像素之间的任何平板电脑尺寸。当我检查该屏幕尺寸的元素时,似乎 .container 没有在这些尺寸之间调整大小。但是,我在我的 css 中看不到任何指定为特定 px 大小的地方,因此覆盖它。我是从以前的开发人员那里接手这个元素的,而且我是响应式代码的新手。任何可以提供的帮助都将是一个巨大的帮助。谢谢!

网站是www.mereo.co

这是来自 lessframework.css 网格的代码示例:

/*  Default 8-column layout
60 px columns, 24 px gutters, 60 px margins, 768 px total
---------------------------------------------------------
1 2 3 4 5 6 7 8
60px 144px 228px 312px 396px 480px 564px 648px */

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}


#if-logged-in {
position: relative;
width: 100%;
height: 24px;
line-height: 24px;
background: #000;
color: #aaa;
font-size: 10px;
z-index: 1000;
}
#if-logged-in .container {
padding-top: 0;
padding-bottom: 0;
}
#if-logged-in p {
margin: 0;
}
#if-logged-in a:link,
#if-logged-in a:visited {
color: #fff;
text-decoration: none;
}
#if-logged-in a:hover {
text-decoration: underline;
}
#if-logged-in a:active {
text-decoration: underline;
margin-bottom: -1px;
}


.container {
/*padding: 0 60px;*/
width: 768px;
margin: 0 auto;
overflow: hidden;
}
#header-image {
padding: 0;
overflow: hidden;
}
/* HEADER IMAGE
full size - 1068x300
8 column layout resized to 890x250 displayed at 648x250
5 column layout resized to 534x150 displayed at 396x150
3 column layout resized to 365x100 displayed at 228x100
*/
#header-image img {
width: 890px;
height: 250px;
margin-left: -121px;
padding: 0;
}
#content {
width: 356px; /* 5 columns */
margin: 0;
padding: 20px;
overflow: hidden;
}
#sidebar {
width: 184px; /* 3 columns */
margin: 0;
padding: 20px;
overflow: hidden;
}

::selection {
background: #c6d8cd;
}
::-moz-selection {
background: #c6d8cd;
}
img::selection {
background: transparent;
}
img::-moz-selection {
background: transparent;
}

最佳答案

特定于该 ipad 大小和分辨率的 .container { } 样式应该在您的媒体查询中。所以如果容器在 iPad 上应该是 400px 宽,那么你的代码应该是:

/* iPad 1 & 2 (landscape) */
@media (device-width: 1024px) and (device-height: 768px) and (orientation: landscape) {
.container {
width: 400px;
/* all other .container styles specific to the iPad 2 in landscape should go here */
}
#if-logged-in {
/* other styles go in their respective selector in the media query */
}
}

不要忘记有一款没有视网膜显示屏的 iPad,如果您有任何背景图像或从 css 加载的 svg 图像,则应将它们设置为指向 2 倍分辨率的 Assets 以看起来不错在视网膜 iPad 媒体查询内的视网膜 iPad 上。

关于ipad - .container 不响应 iPad 的媒体查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17516209/

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