Viewport units for CSS
1vw = 1% of viewport width
1vh = 1% of viewport height
This way, you don’t have to write many different media queries or javascript.
If you prefer JS
window.innerWidth;
window.innerHeight;
More Related Contents:
- How to Create Grid/Tile View? [duplicate]
- Make div stay at bottom of page’s content all the time even when there are scrollbars
- CSS transition effect makes image blurry / moves image 1px, in Chrome?
- Z-Index Relative or Absolute?
- How do I center an SVG in a div?
- Difference between static and relative positioning
- CSS: fixed to bottom and centered
- How to horizontally center a floating element of a variable width?
- CSS Floating Divs At Variable Heights [duplicate]
- Sass Variable in CSS calc() function
- Is it possible to include one CSS file in another?
- Downloading a Google font and setting up an offline site that uses it
- How to display list items as columns?
- Should I use ‘border: none’ or ‘border: 0’?
- How to style a div to be a responsive square? [duplicate]
- How to make round corners to both inside of a box and its border?
- How does one target IE7 and IE8 with valid CSS?
- Background Image for Select (dropdown) does not work in Chrome
- How to change btn color in Bootstrap
- Webpack “OTS parsing error” loading fonts
- difference between body and * in css
- Binding in Control with “class” Attribute
- How to Include CSS style when converting svg to png
- SASS – use variables across multiple files
- How do I select an element only when inside another element?
- iPhone X / 8 / 8 Plus CSS media queries
- Why adds extra top margin?
- Flexbox: flex-start/flex-end, self-start/self-end, and start/end; What’s the difference?
- CSS transition fade in
- How to change Bootstrap navbar collapse breakpoint