Jeremy Buller February 2016
Set the width of an element equal to monitor size WITHOUT varying on zoom
I would like to set the width of an element as a relationship of the native resolution of the viewer's monitor.
I understand that CSS "width:100%;" exists, but I am not happy with the way that method deforms layout, or may behave in a frustrating manner for viewers who want to zoom in/out.
Nuwan Chinthana February 2016
vw and vh are the units which you need to use. viewport (monitor of the user) is measured using vw and vh. (viewport width and viewport height respectively.)
1vw = 1% of Viewport width
vh is the behaving same. 100vh is same as 100% of viewport height.
100vw and 100vh are same to the full monitor width and height.
Asked in February 2016
Viewed 3,469 times
Answered 1 times
Leave an answer
Quote of the day: live life