viewport

Viewport Tag Syntax

拥有回忆 提交于 2019-11-30 20:05:16
I have been looking on the web and I'm still confused on which works and does not. I see errors on chrome when I use the semi-colon, but the iPhone recognizes it. The comma works also without errors. I'm wondering which one is qualified as the correct way of writing it. Semi Colons - <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> Commas - <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" / > https://developer.apple.com/library/archive/documentation/AppleApplications/Reference

How to detect lack of position:fixed in a generic way?

时间秒杀一切 提交于 2019-11-30 18:02:07
问题 On mobile devices such as the iPad, I would like to disable a feature that only works if position:fixed is supported. Is there a way to detect these devices without using the user agent string? The reason is that I would like to avoid searching for iPad, iPhone, iPod, Android, etc if possible. 回答1: Run the following function to test for position:fixed support. function () { var isSupported = null; if (document.createElement) { var el = document.createElement("div"); if (el && el.style) { el

font-size and meta viewport in a responsive design

混江龙づ霸主 提交于 2019-11-30 15:27:08
I have to work on a project that needs to be responsive. It's the first time I'm doing this and I'm stuck with a (possibly stupid) question. Let's say I have this very simple page : <!DOCTYPE html> <html> <head> <style> html{font-size:18px;width:100%;height:100%;margin:0;padding:0;font-family:Verdana, Geneva, sans-serif;} body{font-size:100%;width:100%;height:100%;margin:0;padding:0;} </style> </head> <body > <div style="font-size:1em;"> SOME TEXT TO CHECK IF EVERYTHING'S OK </div> </body> </html> As expected, text font-size is 1em (i.e. 18px in this particular case) on all devices. And, still

Viewport tag not working on Chrome

久未见 提交于 2019-11-30 14:29:08
I'm using the device metrics override in Chrome to test a responsive website for smaller resolutions (320x480 in this case). My viewport meta tag is not making any effect on the page in this case. The logo will appear tiny, and I it's completely unreadable. More or less, I'd say I'm seeing everything in a .5 scale. Here's the head of my HTML: <!DOCTYPE html> <html> <head> <title>Title of the document</title> <link rel="stylesheet" href="css/main.css" /> <link rel="stylesheet" href="css/mediaqueries.css" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,

Viewport units, keeping aspect ratio?

柔情痞子 提交于 2019-11-30 13:05:55
问题 So I've just discovered viewport units, and I really want to use them. First challenge: My element has a "base size" of 760x670 pixels. I want to use viewport units to scale it up so that either the height is 100vh , or the width is 100vw , whichever is smaller. Unfortnately, although I can use 100vmin to get the smaller of the two, I can only apply it to the width or the height, not both. Currently I'm using: #root { width: 760px; height: 670px; width: 100vw; height: calc(670vw/760); } This

Detect when elements within a scrollable div are out of view

怎甘沉沦 提交于 2019-11-30 12:52:00
问题 I need to find a good solution to the following problem. I see a lot of people asking about tracking if an element is in or outside of view Port for the page or browser window. I need to be able to replicate this action, but inside a DIV that scrolls, with overflow:scroll for example. Does anyone know of a good example, for this specific action? Thanks in advance. 回答1: i had the same problem before, i have ended up with the following function.the first parameter is for the element to check,

Setting the Viewport to Scale to Fit Both Width and Height

旧城冷巷雨未停 提交于 2019-11-30 12:49:50
问题 I'm working on a website that fits within a specific width and height (an 885x610 div with a 1px border and 3px top margin). I would like the user to never have to scroll or zoom in order to see the entire div; it should always be fully visible. Since devices have a wide variety of resolutions and aspect ratios, the idea that came to mind was to set the "viewport" meta tag dynamically with JavaScript. This way, the div will always be the same dimensions, different devices will have to be

HTML5 APP开发常用事项

我们两清 提交于 2019-11-30 11:56:29
HTML5 APP开发常用事项 1.常用标签 meta name="format-detection" content="telephone=no" meta name="format-detection" content="email=no" meta name="format-detection" content="adress=no" 也可以连写:meta name="format-detection" content="telephone=no,email=no,adress=no" 顾名思义,它是用来检测html里的一些格式; <meta http-equiv="x-rim-auto-match" content="none"> 这个与上面几个类似,不过针对的平台是BlackBerry's browser。 <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-touch-fullscreen" content="yes" /> apple-mobile-web-app-capable,这meta的作用就是删除默认的苹果工具栏和菜单栏.

Change font size in Vuetify based on viewport?

折月煮酒 提交于 2019-11-30 11:47:45
I have a title: <v-card-text style="font-size:5em"> Some Heading Here </v-card-text> I would like to set font size to 3em when the view is XS. Right now I duplicated it as follows: <v-card-text hidden-xs-only style="font-size:5em"> Some Heading Here </v-card-text> <v-card-text visible-xs-only style="font-size:3em"> Some Heading Here </v-card-text> However I would like to avoid this duplication and solve the issue with CSS alone , but without having to write my own @media queries in the local .vue file. Is that possible? Alternatively, I'm ok with using predefined classes instead of specifying

Is there a bug in the new iOS 7.1 minimal-ui viewport setting?

久未见 提交于 2019-11-30 07:24:00
The new "minimal ui" setting in iOS 7.1 is great for landscape websites. My web app uses a fullscreen, absolute positioned div for its content, to give it an app-like feeling. But Safari seems to add just the height of the URL bar at the bottom. I have tried this on different iPhones, same result... Here is how it looks after the pages loaded: Is this a bug or something I am doing wrong or missing? Click for example (view on iPhone with iOS >= 7.1) I had same problem with iPhone5+ios7.1+minimal-ui. This code successfully fixes this trouble. window.addEventListener('scroll', function () { // Do