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 ???
Viewport meta tag in css
4k Views Asked by titlu At
2
There are 2 best solutions below
0
Bipon Biswas
On
<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.
Related Questions in HTML
- How to store a date/time in sqlite (or something similar to a date)
- How to use custom font during html to pdf conversion?
- Storing the preferred font-size in localStorage
- mp4 embedded videos within github pages website not loading
- Scrimba tutorial was working, suddenly stopped even trying the default
- Is there any way to glow this bulb image like a real light bulb
- With non-graphical maps in Leaflet, zoomDelta doesn't work
- What can I do to improve my coding on both html and css
- Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- Displaying a Movie List on a Website Using Jinja2 and Bootstrap
- How to redirect to thank you page after submitting a Google form embedded into a Google Site?
- Storing selected language in localStorage
- Fences (parenthesis, braces) in HTML and MathML
- Understanding Scroll Anchoring Behavoir
Related Questions in CSS
- How to use custom font during html to pdf conversion?
- Storing the preferred font-size in localStorage
- mp4 embedded videos within github pages website not loading
- Is there any way to glow this bulb image like a real light bulb
- What can I do to improve my coding on both html and css
- Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- How to increase quality of mathjax output?
- Hover animation resetting( seemingly reverting back to original CSS and then again to hover)when moving mouse horizontaly accross a part of an element
- Storing selected language in localStorage
- How to clip grid cell and provide scroll as well?
- KeyboardAvoidingView makes a messy the flexbox
- Rotate an object around another object in javascript
- Understanding Scroll Anchoring Behavoir
- how to use only block layout in this css code?
Related Questions in RESPONSIVE-DESIGN
- Javascript Place Image Where User Clicks
- How can i prevent the image from zooming in when i resize the browser?
- Como mudar o src de uma imagem por responsividade
- What CSS & HTML do I need to switch a table from 4 cols of data in 1 row to 2 cols in 2 rows at 550px screen width w/o duplicate content?
- How to make my relatively-positioned elements 'stick' to a specific yet responsive background design without breaking from the design?
- How to Place a "Copy to Clipboard" Icon Inside of an Input Text Box?
- I'm trying to make a responsive SVG, but it isn't showing on Safari
- react-slick library carousel breakpoints do not work on mobile
- I want to create a creative website based on my project. I am new in this field
- Why is my display element not responsive?
- Dynamic sizing and responsive design
- How do I Center Score Text for a Basketball Scoreboard?
- Bootstrap 5.3 burger menu not responsive in Underscore WordPress template
- Why does it shows good in the editor and something completely different in the emulator?
- CSS formatting with flexbox and other divs
Related Questions in VIEWPORT
- How to place cdk-overlay-container inside cdk-virtual-scroll-viewport instead of document body
- Google Maps - Event listeners (`idle`, `projection_changed`) not triggered until map is scrolled into view
- How to lock a 3x3 grid to the viewport regardless of content size?
- Overflow scrolling not scrolling left
- Page scales down on mobile when width is below 980px
- Meta Problem Issue - doesnt scale for Iphones
- I added a jQuery Toggle function and now my CSS responsive code has stopped working
- SDL2/C++: I'm confused about centering the viewport in SDL2
- IntersectionObserver: Responsive/Dynamic "threshold" option
- Virtual Keyboard does not restore height of the viewport to its initial when closed
- How to prevent the address bar in mobile safari from overlapping the top of the page?
- Capacitor on Android Unable to "scale down" page using viewport
- Viewport Frame for Camera System in Roblox Studio not Working
- How to stop video from playing on scroll?
- Does IntersectionObserver consider visible a div that is inside the viewport, but covered by another div?
Related Questions in DEVICE-WIDTH
- CSS Box Sizing Issue
- Samsung Tab A8 - CSS Media Query - Chrome Dev Tools
- Media query max-width: 767px is not applied even though the width is 767px
- Image element same size as window: closed
- Wrong container size in mobile
- Why 1rem bigger then 1.1rem, 1.2rem etc
- how to add responsive buttons for mobile? buttons needs to stack into a column. Having difficulty
- html meta viewport user-scalable=no seemed no longer working on iOS 13.3
- Setting good font-size for 980px mobile viewport (without meta[@name="viewport"])
- How to manipulate screen-size/viewport size, so desktop will display mobile version of website?
- Adjust cordova screen width on xhdpi
- How to get viewport considered as width=device-width in Fancybox
- How to fix overflow issue when zoomin on desktop(mobile responsive website)
- Detect if browser window is maximized and at default (100%) zoom
- Mobile websites are presented wider than the device, once pinched is ok
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The correct
metatag for a responsive website is the following:The
width=device-widthpart sets the width of the page to follow the screen-width of the device. Theinitial-scale=1part sets the initial zoom level when the page is first loaded by the browser. You don't need to set a specific height, sincewindowdimensions are always both scaled on change. But in case, you can change the content of themetatag with:Have a look here if you have more doubts.