Using VH or VW to size things in css/html does not work correctly?

So, I’ve watched quite a few tutorials on VH and VH saying that they work similar to % except the work off of the entire page and not the parent element.

that sounds fantastic and really useful! BUT they don’t work that way for me at all.

so, for example, when I set my images VW to 100 it barely does anything. it’s maybe 8% of the screen width when it should span across the entire screen? right? in fact when I take a look at the width of the image after doing this it says it’s 100 pixels wide. anyone want to explain what’s going on?

I thought VH and VW go off of the entire screen size? so 100vw should be 100% of the screen, right?

Hi, please share your codes so we can see what’s going on. You can display codes by wrapping it within two sets of triple backticks (```).

vw stands for viewport width, vh stands for viewport height, so to set something to fully occupy the whole screen:

.someClass {
  width: 100vw;
  height: 100vh;  
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.