Static viewport width - html

I want my website to have a static viewport width of 350px. Always. Those 350px should span the entire device width. How do I do this? Is the <meta name="viewport"> enough? I tried setting the width=350, but that didn't do anything.

for a static viewport you must set the content on the meta tag.
try like this:
<meta name="viewport" content="width=350">
Note : You can't notice the change in desktop.

Related

Viewport meta tag in css

In viewport meta tag in CSS for achieving responsive web design we set width = device-width like <meta name="viewport" content="width=device-width"> so that the page's width equal to that of the device's width , so that users do not have to scroll to see the page but what about the height ? Does the browser infer the height based on the width and make it device-height ???
The correct meta tag for a responsive website is the following:
<meta name="viewport" content="width=device-width, initial-scale=1">
The width=device-width part sets the width of the page to follow the screen-width of the device. The initial-scale=1 part sets the initial zoom level when the page is first loaded by the browser. You don't need to set a specific height, since window dimensions are always both scaled on change. But in case, you can change the content of the meta tag with:
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
Have a look here if you have more doubts.
<meta name="viewport" content="width=device-width, initial-scale=1">
The width property controls the size of the viewport. It can be set to a specific number of pixels like width=600 or to the special value device-width which is the width of the screen in CSS pixels at a scale of 100%. (There are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.)
Read this https://developer.mozilla.org/en/docs/Mozilla/Mobile/Viewport_meta_tag then hope clear everything.

How Do I Make My Site Full Size in Mobile?

I have tried every variation I can think of to try and get my site to show up correctly on mobile. I've entered these codes into my head tags, but to no avail:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0" />
And all other variations! Nothing makes me able to change the original look of the site on mobile, or allow me to zoom in or out! I have no idea what to do next. If there's ANY advice you guys can give, I'm desperate.
The site is www.justthestork.com
Sounds like you want your site to load as it does on a desktop browser but zoomed out? In that case you want to give your content a constant width that's larger than the screen size:
<meta name="viewport" content="width=1024">
This means that your page will layout into a window that's 1024 pixels wide (you can adjust the width to see what looks best). The browser will then zoom out until it fits on the screen.
If you don't specify a viewport <meta> at all, the browser will pick a default width (e.g. 980px).
Try this one here, it should force the correct screen size:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">

I have a mobile website but it loads zoomed out. How can I fix this?

I have a mobile website but it loads zoomed out. How can I fix this.
You should insert the Viewport meta tag.
<meta name="viewport" content="width=device-width, initial-scale=1">
This means that the browser will (probably) render the width of the
page at the width of its own screen. So if that screen is 320px wide,
the browser window will be 320px wide, rather than way zoomed out and
showing 960px (or whatever that device does by default, in lieu of a
responsive meta tag).
Reference: Css-Tricks - Responsive Meta Tag - MDN - Using the viewport meta tag to control layout on mobile browsers
You might need to set the viewport
<meta name="viewport" content="width=device-width, initial-scale=1" />
http://davidbcalhoun.com/2010/viewport-metatag/

Scalling CSS for other monitors

My website is positioned perfectly for me but not for my larger monitor. The div's are more compact on the larger monitor and incorrect. How can I fix this?
You need to use media query for responsive. if you used it, may be your meta tag is not working correctly.
below the examples are.....
#media screen and (min-width:00px) and (max-width:00px){
/*extra style will goes here.
}
Don't forget to use this <meta .../> tag on <head></head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
I believe that you have problems because you hard-coded the sizes.
I'd suggest you to use relative sizes, e.g.:
#el{
width:50%;
height:100%;
}
In the above example, an element with id = "el" will have width which will be half the width of the window and the height of this element will be equal to the height of window (unless this element is located in another element, the width and height of which is less than 100%).

Why does the meta "viewport" tag make my page looked zoomed in on Android device?

I'm trying to make my site more "responsive" on mobile devices.
http://healthybodyguru.com
I've tried a lot of variations of the "viewport" meta tag, which is currently:
<meta name="viewport" content="width=device-width, initial-scale=1" />
But for some reason on my HTC Vivid, the page loads quite zoomed in:
Any ideas how I can adjust the viewport so the page is 100% visible on my Android?
Maybe try something like this:
<meta name="viewport" content="width=320px, initial-scale=1, maximum-scale=1"/>
I'm still trying to understand the viewport to be honest. But I think, I maybe got it now. The viewport width should be set to the default viewable width of the content. For example: If you just have an <img/> with width: 320px, than the image will be fullscreen if you use the code above.
initial-scale=1
Is causing it to load zoomed in. You can either remove it, or replace it with maximum-scale or minimum-scale (for whatever you're trying to achieve).
This code is working for me great ... I hope it will work for you too ...
// fit the width of screen
myWebView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
// remove a weird white line on the right size
myWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);