viewport

移动端页面布局的那些事儿

倾然丶 夕夏残阳落幕 提交于 2019-11-29 16:25:57
移动端页面布局的那些事儿 http://www.xiaoxiangzi.com/Programme/CSS/4298.html 一. viewport 什么是viewport 简单来讲,viewport就是浏览器上,用来显示网页的那一部分区域了,也就是说,浏览器的实际宽度,是和我们手机的宽度不一样的,无论你的手机宽度是320px,还是640px,在手机浏览器内部的宽度,始终会是浏览器本身的viewport。如今的浏览器,都会给自己的本身提供一个viewport的默认值,可能是980px,或者是其他值。就以手机来说吧,目前,新版本的手机浏览器,绝大部分是以980px作为默认的viewport值的。我这里对新版本的不同平台下的浏览器做了测试,经过测试,iphone下的默认viewport为980px,安卓下的浏览器,目前主流的最新浏览器(比如chrome,还有很多国产的像qq,uc)的viewport也是980px了。 viewport是用来干什么的 viewport的默认值,一般来说是大于手机屏幕的。这样就可以做到当我们在浏览桌面端网页的时候,可以让桌面端端网页正常显示(我们普通页面设计的时候,一般页面的主区域是以960px来做的,所以980px这个值,可以做到桌面端网页的正常显示)。但是,其实我们手机的屏幕宽度是没有960px的,因此浏览器会出现横向滚动条。同时

浅谈前端移动端页面开发(布局篇)

笑着哭i 提交于 2019-11-29 16:25:48
http://www.xiaoxiangzi.com/Programme/CSS/4298.html 前言的一些碎碎念:最近一直在写移动端的页面,不过一直是用的别人造好的轮子,很多时候并没有想那是为什么,那是怎么样要那么写,就跟着别人的文档 去了。本以为自己对移动端的那一丢丢理解,结果很多东西都特么有问题,所以,今天停下了手中的一些东西,来谈下移动端的布局方案吧 内容有些长,这也是我第一次写博客,不足之处还请严厉指出 一. viewport 什么是viewport 简单来讲,viewport就是浏览器上,用来显示网页的那一部分区域了,也就是说,浏览器的实际宽度,是和我们手机的宽度不一样的,无论你的手机 宽度是320px,还是640px,在手机浏览器内部的宽度,始终会是浏览器本身的viewport。如今的浏览器,都会给自己的本身提供一个 viewport的默认值,可能是980px,或者是其他值。就以手机来说吧,目前,新版本的手机浏览器,绝大部分是以980px作为默认的 viewport值的。我这里对新版本的不同平台下的浏览器做了测试,经过测试,iphone下的默认viewport为980px,安卓下的浏览器,目 前主流的最新浏览器(比如chrome,还有很多国产的像qq,uc)的viewport也是980px了。 viewport是用来干什么的 viewport的默认值

移动端 --- 布局

混江龙づ霸主 提交于 2019-11-29 16:25:32
转自 --- 一. viewport 什么是viewport 简单来讲,viewport就是浏览器上,用来显示网页的那一部分区域了,也就是说,浏览器的实际宽度,是和我们手机的宽度不一样的,无论你的手机宽度是320px,还是640px,在手机浏览器内部的宽度,始终会是浏览器本身的viewport。如今的浏览器,都会给自己的本身提供一个viewport的默认值,可能是980px,或者是其他值。就以手机来说吧,目前,新版本的手机浏览器,绝大部分是以980px作为默认的viewport值的。我这里对新版本的不同平台下的浏览器做了测试,经过测试,iphone下的默认viewport为980px,安卓下的浏览器,目前主流的最新浏览器(比如chrome,还有很多国产的像qq,uc)的viewport也是980px了。 viewport是用来干什么的 viewport的默认值,一般来说是大于手机屏幕的。这样就可以做到当我们在浏览桌面端网页的时候,可以让桌面端端网页正常显示(我们普通页面设计的时候,一般页面的主区域是以960px来做的,所以980px这个值,可以做到桌面端网页的正常显示)。但是,其实我们手机的屏幕宽度是没有960px的,因此浏览器会出现横向滚动条。同时,即使是基于980的viewport,我们在移动端浏览我们的桌面页面的体验其实也并不好,所以,一般的

第122天:移动端开发常见事件和流式布局

≯℡__Kan透↙ 提交于 2019-11-29 16:19:09
一、流式布局 1、 什么是流式布局 流式布局就是 百分比布局 ,通过盒子的 宽度 设置成 百分比 来 根据屏幕的宽度来进行伸缩 ,不受固定像素的限制,内容向两侧填充,同时会 设定最小宽度 和 最大宽度 ,适用于图片比较多的 首页、门户、电商 等。 在这里我们以京东的M站为例进行说明: 可以看到,在京东各个模块的主容器中,都设置了最大最小宽度和宽度100%,而在导航区块中,由于一行有5个小区块,所以设置了宽度为20%,使得小区块也能达到自适应的效果。 2、 viewport 在移动端用来承载网页的这个区域就是我们的 视觉窗口 viewport ,这个区域可以设置 高度宽度 ,可以按比例放大缩小,而且能设置 是否允许用户自行缩放 。 width :设置的是 viewport 宽度,可以设置 device-width 特殊值。 initial-scale :初始缩放比,大于0的数字,一般设置为1.0。 maximum-scale :最大缩放比,大于0的数字。 minimum-scale :最小缩放比,大于0的数字。 user-scalable :用户是否可以缩放,yes或no(1或0)。 <!--视口标签通可以使用 meta:vp + tab 来快速生成,通常我们可以设置为下边这样。--> <meta name="viewport" content="width=device-width

How to enable user-scalable (viewport property) after disabling it?

江枫思渺然 提交于 2019-11-29 15:24:48
I created an Android app with Phonegap. I want to be able to have a fixed div in one page and to zoom-in in another page. I use jquery mobile 1.2.0, Jquery 1.8.2, Phonegap 2.0.0 and Android 2.2. My code is: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My Phonegap Application</title> <link rel="stylesheet" href="./lib/jquery.mobile-1.2.0.css" /> <script src="./lib/jquery-1.8.2.js"></script> <script src="./lib/jquery.mobile-1.2.0.js"></script> <script src="./lib/cordova-2.0.0.js" type="text/javascript"></script> <meta id="viewport" name="viewport" content="initial-scale=1.0,

Load mobile CSS if user is on Android

◇◆丶佛笑我妖孽 提交于 2019-11-29 15:03:12
My .htaccess file is writing a "smart" cookie. If my page reads this cookie it will write a div. Then my mobile CSS file loads only if the user's on an iPhone or iPod. My question is, how can I edit this code (below) to load the mobile CSS file if the user's on an Android? Here's my page and code: <meta name="viewport" content="width=device-width, user-scalable=yes" /> <link rel="stylesheet" type="text/css" href="css/mobile.css" media="only screen and (max-width: 640px)" /> <script type="text/javascript"> if (window.screen.width > 640){document.write('<meta name="viewport" content="width=980,

Layout using vh does not scale with zoom

岁酱吖の 提交于 2019-11-29 14:43:57
I've tried to create a login form using ONLY vh sizes. Doing this, in the hopes that the form, in all, would scale accordingly to the viewport. It doesn't! For some reason zooming in, creates a blank space that keeps getting bigger the more you zoom, between the input fields and the text below. http://jsfiddle.net/TnY3L/ The fiddle isn't very well made, just copied it from my project. But you can see what's wrong - and that's what counts. Anyone have any idea as to how I were to go about fixing this? <span id="loginform"> <input type="text" name="login" class="LFORM" placeholder="USERNAME" />

Viewport meta tag for desktop browsers?

耗尽温柔 提交于 2019-11-29 12:45:04
问题 My client is asking me to reduce size of current website for desktop browsers by 30%. is there a css or meta tag to do it like viewport meta tag on a mobile browser? 回答1: You can look at the css screen media type. It is: Intended primarily for color computer screens. You can use it this way: @media screen { body { font-size: 70% } } There is also a handheld media type, primarily: Intended for handheld devices (typically small screen, limited bandwidth). However, you will need to test the

window.innerWidth in Chrome's device mode

本小妞迷上赌 提交于 2019-11-29 09:39:28
When in google chrome's device mode, what does window.innerWidth return? Is it the viewport of the device (plus any scroll bars)? I'm getting different values for the device's width x height (the dimensions on top of the page - the device's viewport?) and window.innerWidth x window.innerHeight (browser's viewport?). Is this supposed to happen? Here's a picture of what I'm getting, and the code I used. <!doctype html> <html> <head></head> <body> <script> var image; window.onload = function() { image = document.getElementById("img"); checkWindowSize(); window.addEventListener('resize', function

R adding a datatable to a ggplot graph using viewPorts : Scaling the Grob

不羁岁月 提交于 2019-11-29 08:44:33
问题 I'm trying to add a data-table to a graph made in ggplot (similar to the excel functionality but with the flexibility to change the axis its on) I've had a few goes at it and keep hitting a problem with scaling so attempt 1) was library(grid) library(gridExtra) library(ggplot2) xta=data.frame(f=rnorm(37,mean=400,sd=50)) xta$n=0 for(i in 1:37){xta$n[i]<-paste(sample(letters,4),collapse='')} xta$c=0 for(i in 1:37){xta$c[i]<-sample((1:6),1)} rect=data.frame(xmi=seq(0.5,36.5,1),xma=seq(1.5,37.5,1