简体   繁体   English

手机/平板电脑上的响应站点,页眉和页脚宽度问题

[英]Responsive site, header and footer width issues on mobile / tablet

I have been working on a modified wordpress site (heavily modified theme), and have run into a css / responsive related issue. 我一直在修改Wordpress网站(主题大量修改)上工作,并且遇到了CSS /响应相关问题。

When the body has an unusually large-width item, or a dynamic item (dynamic in terms of width, like a jQuery DataTable) whose width goes beyond the body, the sites header and footer do not properly expand to occupy the full width of the body. 当主体具有异常大的宽度的项目或宽度超出主体的动态项目(在宽度方面是动态的,例如jQuery DataTable)时,网站的页眉和页脚将无法正确扩展以占据其整个宽度身体。

for a live example visit this link (however you will need to use a user-agent modifier or use chrome emulator, either of which set to iPad or iPhone, for example). 有关实际示例,请访问此链接(例如,您将需要使用用户代理修饰符或使用chrome仿真器,例如,将两者设置为iPad或iPhone)。

image example: 图片示例:

http://vicariauction.com/cars-coffee/ http://vicariauction.com/cars-coffee/

(notice how the header and footer dont expand to the width of the "map" image in the body) (请注意页眉和页脚如何扩展到正文中“地图”图像的宽度)

-- here is a link to a screen shot of the above page, showing the exact issue: -这是上一页屏幕截图的链接,显示了确切的问题:

i.imgur.com/BUjzLAK.jpg i.imgur.com/BUjzLAK.jpg

jQuery dataTables example: jQuery dataTables示例:

http://vicariauction.com/future-auctions/?ahcode=NOLA%202015 http://vicariauction.com/future-auctions/?ahcode=NOLA%202015

(notice how the header and footer dont expand to the width of the jquery datatable below) (注意页眉和页脚如何不扩展到下面的jquery数据表的宽度)

-- here is a link to a screen shot of the above page, showing the exact issue: -这是上一页屏幕截图的链接,显示了确切的问题:

i.imgur.com/4nx2M5v.jpg i.imgur.com/4nx2M5v.jpg

Both examples, header and footer's widths scale properly if using anything but a mobile or tablet device (or user-agent). 如果使用的不是移动设备或平板电脑设备(或用户代理),则两个示例(页眉和页脚的宽度)都可以正确缩放。

I realize the answer may not be a simple explanation, but can anyone maybe at least point me in the general direction that i should be looking towards for a solution? 我意识到答案可能不是一个简单的解释,但是任何人都至少可以指出我应该寻求解决方案的一般方向吗?

thanks! 谢谢!

Instead of making the header wider, why not make the image narrower? 为什么不使标题变窄而不是使标题变宽? Mobile users shouldn't have to scroll horizontally anyway. 移动用户无论如何都不必水平滚动。

To make the image fit the width of the screen, use the following CSS style on the image: 要使图像适合屏幕的宽度,请在图像上使用以下CSS样式:

max-width: 100%;
height: auto;

I realize this only answers part of your question, but it's definitely what I would do with the image. 我意识到这只能回答您部分问题,但这绝对是我要处理的图像。


On an unrelated note, I noticed that in future-auctions/styleau.css , line 18, you have the following line: 在不相关的注释上,我注意到在future-auctions/styleau.css第18行中,您具有以下行:

*{box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box;}

Prefixed CSS rules should always come first, so the correct way to write that line is: 前缀CSS规则应始终排在第一位,因此编写该行的正确方法是:

*{-webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box;}

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

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