简体   繁体   English

iPad / iPhone上的CSS问题

[英]CSS Issue on iPad/iPhone

I have extensive experience in CSS and I cannot figure out what's going on with this one site I'm working on: 我在CSS方面拥有丰富的经验,我无法弄清我正在处理的这个站点的状况:

http://lockwoodstorage.com/ http://lockwoodstorage.com/

Everything looks fine on all browsers but on iPhone and iPad, the content backgrounds cut off on the left side. 在所有浏览器上,一切看起来都很好,但是在iPhone和iPad上,内容背景在左侧被切断。 I've tried media queries and I've tried to locate in the browsers what container could be causing this but I can't seem to figure it out. 我尝试了媒体查询,并尝试在浏览器中找到可能导致此问题的容器,但我似乎无法弄清楚。

I know this is a pretty basic question (and I always use Stack Overflow as last resort) but perhaps there is an issue here that I'm not versed in (and that could help in the forum in the future; I will update the question if it is something more complex). 我知道这是一个非常基本的问题(我总是使用Stack Overflow作为最后的手段),但是也许这里有一个我不熟悉的问题(将来可能会对论坛有所帮助;我将更新问题)如果它更复杂)。 Any ideas would be greatly appreciated. 任何想法将不胜感激。 Thank you! 谢谢!

EDIT 编辑

FYI, I'm not trying to make this site responsive. 仅供参考,我不是要使该网站响应。 I'm just trying to make it display correctly on iPhone and iPad. 我只是想使其在iPhone和iPad上正确显示。 I've also been seeing an issue where the load time is SUPER slow on iOS for some reason. 我也一直因为某些原因在iOS上的加载时间过慢的问题。

When putting this site together, I used the Twenty Twelve theme and just customized it to my liking. 将这个站点放在一起时,我使用了“十二十二”主题,并根据自己的喜好对其进行了自定义。 It wasn't a responsive theme, just a basic one. 这不是一个响应主题,只是一个基本主题。

I've put a bounty out for this. 我为此付出了很多。 Have at it! 加油! Thanks for the help. 谢谢您的帮助。

In your header you are using CSS float:left property which is causing this problem.Just remove this CSS property and your problem will be solved. 在标头中,您使用的是CSS float:left属性,这会导致此问题。只需删除此CSS属性,您的问题就会得到解决。

And then if you want to float your elements to the left in header you can do it by targeting each individual element. 然后,如果要将元素浮动到标题的左侧,则可以通过定位每个单独的元素来实现。 for Example 例如

#logo, #nav
{
 float:left;
} 

Also @ <div id=page> change max-height to min-height and you all set to go. 同样,@ <div id=page>将max-height更改为min-height,然后大家都准备好了。 I hope it will help you. 希望对您有帮助。

您必须在max-height:485px的位置使用min-height:485px max-height:485px

If you are going to make a website responsive you should build it mobile first. 如果要使网站具有响应能力,则应首先将其构建为移动设备。 That way you can style each element with regards to the device to it gets displayed correctly, adding break points along the way for bigger devices. 这样,您就可以正确显示与设备有关的每个元素的样式,并为较大的设备添加断点。

At the moment it looks like you have built the site for desktop and then added a few media queries to reposition elements to try and make them fit. 目前,您似乎已经为台式机构建了站点,然后添加了一些媒体查询来重新定位元素,以使其变得合适。 This will create more work for you and will definitely be frustrating. 这将为您创造更多的工作,并且一定会令人沮丧。

If you want the site looking good on all devices I would recommend starting with mobile and restyling it, then work your way up to tablet and then desktop. 如果您希望该网站在所有设备上都能正常显示,我建议您先从移动设备上进行重新样式设置,然后逐步升级到平板电脑和台式机。

Mx I'll also agree with David. Mx我也会同意David的看法。 you should develop it mobile first because the way you are trying to customize it for mobile will take a lot of time and effort if you have issues in many places. 您应该首先开发移动设备,因为如果您在许多地方遇到问题,则尝试为移动设备自定义它的方法将花费大量时间和精力。

if you have issues in few places you can do it by putting media queries, Percentages for widths and heights instead of fix values. 如果您在几个地方都遇到问题,则可以通过媒体查询,宽度和高度的百分比(而不是固定值)来完成。 similarly you can use em instead of pixels where ever required. 同样,您可以在需要时使用em代替像素。

However, as I mentioned earlier this will take more time to customize. 但是,正如我之前提到的,这将需要更多时间进行自定义。 So, i'll suggest to use Zurb Foundation or Twitter Bootstrap. 因此,我建议使用Zurb Foundation或Twitter Bootstrap。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM