2017-08-08 249 views
0

其实我加了一些代码到我的html页面Html页面大小iPhone屏幕

<meta name= "viewport" content= "width = device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> 

我认为这将导致一个网页,适用于所有设备

但结果是 Picture 1

虽然原来的是 Picture 2

而如果你会告诉我,我可以ch安格图片的大小,其实我需要这个尺寸正好.. 因为它是需要如上图2

回答

1

好大小,也许你可以删除:

<meta name= "viewport" content= "width = device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> 

因为它不会让用户可以看到整个页面。

+0

我应该添加什么? – AxA

+1

@AxA我不确定你的其他代码,但你应该使用相对宽度值,例如宽度:100%。 – Kumquat

+0

其实当我删除它..它变得更好..但仍然没有显示一切! – AxA

0

尝试

body {background-size: cover;} 

背景尺寸:盖; - 为您的背景图像元素)

0

我会建议你使用CSS MediaQueries来做响应。这样做

@media(min-width: your width in px;){ 
    // Your styles go here. 
    // here you can resize the widths and change other styles of your html 
    //elements 
    // when the device screen equals your defined min-width or above 

}

然后

@media(max-width: your width in px;){ 
    // Your styles go here. 
    // here you can resize the widths and change other styles of your html 
    //elements 
    // when the device screen equals your defined max-width or below 

}

希望这有助于。有关响应风格的更多信息,请访问此链接https://www.w3schools.com/css/css_rwd_mediaqueries.asp