在iPhone上查看div时如何更改div的宽度?

问题描述 投票:0回答:2

我想要做的是使帖子和页面顶部的选择框的div延伸。我想在CSS中使用width:100%属性来实现它,但它只是在中途延伸。

所以我手动将宽度设置为100%的像素数。但问题是它在iPhone / iPad上造成显示问题。

有没有办法让iPhone / iPad上的div更改宽度适合比例?我怎么能这样做?

谢谢!

利兹

码 - -

.page-opt {
margin-left:-314px;
width:1583px;
clear: both;
margin-bottom:-20px;
padding-bottom:-20px;
position: relative;
}

/* Non-Retina */
@media screen and (-webkit-max-device-pixel-ratio: 1) {
margin:0;
}

/* Retina */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
margin:0;
}

/* iPhone Portrait */
@media screen and (max-device-width: 480px) and (orientation:portrait) {
margin:0;
} 

/* iPhone Landscape */
@media screen and (max-device-width: 480px) and (orientation:landscape) {
margin:0;
}

/* iPad Portrait */
@media screen and (min-device-width: 481px) and (orientation:portrait) {
margin:0;
}

/* iPad Landscape */
@media screen and (min-device-width: 481px) and (orientation:landscape) {
margin:0;
}
iphone ipad html width
2个回答

0
投票

尝试

#youroptinid { max-width: 1600px; width: 100%; clear: both; }

如果这不起作用,请发布您的html和CSS代码,以便我们为您提供帮助。没有代码,我们只能推测。

© www.soinside.com 2019 - 2024. All rights reserved.