Twitter Bootstrap 的响应式 CSS 适用于调整大小的窗口,但不适用于移动设备 [英] Twitter Bootstrap's responsive CSS works on resized window, but not on mobile
问题描述
我使用 Twitter Bootstrap 框架来构建我的最新网站.我使用 boostrap.responsive.css
让它在移动设备上工作.但事实并非如此.似乎根本看不到 CSS.当我在我的 Android 手机上运行它时,它就像我的 PC 一样显示我的网站.但是当我在 PC 上调整浏览器窗口的大小时,效果很好.可能是什么问题?我没有弄乱引导程序的 css.
I've used Twitter Bootstrap framework to build my newest site. I used boostrap.responsive.css
to make it work on mobile devices. But it doesn't. It seems like it doesn't see the CSS at all. When I ran it on my Android phone, it was displaying my site just like my PC. But when I resize my browser window on PC, it works great. What can be the problem? I haven't messed with bootstrap's css.
当我运行 alert($(window).width());
时,它返回 980.
When I ran alert($(window).width());
, it returned 980.
推荐答案
确保按照 Bootstrap 的 响应式文档 因此布局将缩放到设备宽度.
Make sure to include the meta viewport element as instructed in Bootstrap's responsive docs so the layout will scale to the device width.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
这篇关于Twitter Bootstrap 的响应式 CSS 适用于调整大小的窗口,但不适用于移动设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!